aboutsummaryrefslogtreecommitdiff
path: root/include/cru/common/String.hpp
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2021-10-26 16:32:13 +0800
committercrupest <crupest@outlook.com>2021-10-26 16:32:13 +0800
commit9dec93315173999c4fb9ab5a0e57909eb5e7fd8b (patch)
tree042fff007fc3d0959146f131f425b9626448718e /include/cru/common/String.hpp
parent397843cda9e4161d3e92d8797f8012f478ce64f0 (diff)
downloadcru-9dec93315173999c4fb9ab5a0e57909eb5e7fd8b.tar.gz
cru-9dec93315173999c4fb9ab5a0e57909eb5e7fd8b.tar.bz2
cru-9dec93315173999c4fb9ab5a0e57909eb5e7fd8b.zip
...
Diffstat (limited to 'include/cru/common/String.hpp')
-rw-r--r--include/cru/common/String.hpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/cru/common/String.hpp b/include/cru/common/String.hpp
index 13176fc6..5d09d380 100644
--- a/include/cru/common/String.hpp
+++ b/include/cru/common/String.hpp
@@ -166,6 +166,10 @@ class CRU_BASE_API String {
public:
String& operator+=(StringView other);
+ operator std::u16string_view() const {
+ return std::u16string_view(data(), size());
+ }
+
public:
Utf16CodePointIterator CodePointIterator() const {
return Utf16CodePointIterator(
@@ -264,6 +268,10 @@ class CRU_BASE_API StringView {
value_type operator[](Index index) const { return ptr_[index]; }
+ operator std::u16string_view() const {
+ return std::u16string_view(data(), size());
+ }
+
private:
const char16_t* ptr_;
Index size_;