diff options
Diffstat (limited to 'thirdparty/icu4c/common/unicode/stringpiece.h')
-rw-r--r-- | thirdparty/icu4c/common/unicode/stringpiece.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/thirdparty/icu4c/common/unicode/stringpiece.h b/thirdparty/icu4c/common/unicode/stringpiece.h index 6f2a50eafc..74919d7222 100644 --- a/thirdparty/icu4c/common/unicode/stringpiece.h +++ b/thirdparty/icu4c/common/unicode/stringpiece.h @@ -32,6 +32,7 @@ #if U_SHOW_CPLUSPLUS_API #include <cstddef> +#include <string_view> #include <type_traits> #include "unicode/uobject.h" @@ -176,6 +177,16 @@ class U_COMMON_API StringPiece : public UMemory { */ StringPiece(const StringPiece& x, int32_t pos, int32_t len); +#ifndef U_HIDE_INTERNAL_API + /** + * Converts to a std::string_view(). + * @internal + */ + inline operator std::string_view() const { + return {data(), static_cast<std::string_view::size_type>(size())}; + } +#endif // U_HIDE_INTERNAL_API + /** * Returns the string pointer. May be nullptr if it is empty. * |