add basic_string_view cast operator to text::Encoded_character
authorJacob Lifshay <programmerjake@gmail.com>
Thu, 29 Jun 2017 07:27:08 +0000 (00:27 -0700)
committerJacob Lifshay <programmerjake@gmail.com>
Thu, 29 Jun 2017 07:27:08 +0000 (00:27 -0700)
src/util/text.h

index e68eb499e580d927859d3bce1bafd59817a4629b..70f04c1906d6c0967154fac1d693325c0beaece7 100644 (file)
@@ -201,6 +201,11 @@ public:
     {
         return std::basic_string<Char_type, Char_traits, Allocator>(begin(), end());
     }
+    template <typename Char_traits>
+    constexpr operator basic_string_view<Char_type, Char_traits>() const noexcept
+    {
+        return basic_string_view<Char_type, Char_traits>(chars, used);
+    }
     template <typename Char_traits, typename Allocator>
     friend std::basic_string<Char_type, Char_traits, Allocator> operator+(
         std::basic_string<Char_type, Char_traits, Allocator> a, const Encoded_character &b)