diff --git a/include/boost/static_string/static_string.hpp b/include/boost/static_string/static_string.hpp index 90049e0..5e32113 100644 --- a/include/boost/static_string/static_string.hpp +++ b/include/boost/static_string/static_string.hpp @@ -81,7 +81,7 @@ public: /// The type of `string_view` returned by the interface using string_view_type = - string_view; + basic_string_view; //-------------------------------------------------------------------------- // @@ -957,14 +957,14 @@ public: /** Insert into the string. - Inserts elements from `string_view{t}` at the position `index` + Inserts elements from `string_view_type{t}` at the position `index` The inserted string can contain null characters. This function participates in overload resolution if `T` is convertible to `string_view` and `T` is not convertible to `CharT const*`. - @throw std::length_error if `string_view{t}.substr(index_str, count).size() > max_size() - size()` + @throw std::length_error if `string_view_type{t}.substr(index_str, count).size() > max_size() - size()` @return `*this` */ template @@ -985,15 +985,15 @@ public: /** Insert into the string. - Inserts elements from `string_view{t}.substr(index_str, count)` at the position `index` + Inserts elements from `string_view_type{t}.substr(index_str, count)` at the position `index` The inserted string can contain null characters. This function participates in overload resolution if `T` is convertible to `string_view` and `T` is not convertible to `CharT const*`. - @throw std::out_of_range if `index_str > string_view{t}.size()` - @throw std::length_error if `string_view{t}.substr(index_str, count).size() > max_size() - size()` + @throw std::out_of_range if `index_str > string_view_type{t}.size()` + @throw std::length_error if `string_view_type{t}.substr(index_str, count).size() > max_size() - size()` @return `*this` */ template @@ -1198,14 +1198,14 @@ public: /** Append to the string. - Appends characters from `string_view{t}` + Appends characters from `string_view_type{t}` The appended string can contain null characters. This function participates in overload resolution if `T` is convertible to `string_view` and `T` is not convertible to `CharT const*`. - @throw std::length_error if `string_view{t}.size() > max_size() - size()` + @throw std::length_error if `string_view_type{t}.size() > max_size() - size()` @return `*this` */ template @@ -1223,20 +1223,20 @@ public: append( T const& t) { - return append(string_view{t}); + return append(string_view_type{t}); } /** Append to the string. - Appends characters from `string_view{t}.substr{pos, count}` + Appends characters from `string_view_type{t}.substr{pos, count}` The appended string can contain null characters. This function participates in overload resolution if - `T` is convertible to `string_view` and `T` is not + `T` is convertible to `string_view_type` and `T` is not convertible to `CharT const*`. - @throw std::out_of_range if `pos > string_view{t}.size()` - @throw std::length_error if `string_view{t}.substr(pos, count).size() > max_size() - size()` + @throw std::out_of_range if `pos > string_view_type{t}.size()` + @throw std::length_error if `string_view_type{t}.substr(pos, count).size() > max_size() - size()` @return `*this` */ template @@ -1256,7 +1256,7 @@ public: size_type pos, size_type count = npos) { - return append(string_view{t}.substr(pos, count)); + return append(string_view_type{t}.substr(pos, count)); } /** Append to the string. @@ -1328,7 +1328,7 @@ public: The appended string can contain null characters. This function participates in overload resolution if - `T` is convertible to `string_view` and `T` is not + `T` is convertible to `string_view_type` and `T` is not convertible to `CharT const*`. @throw std::length_error if `string_view_type{t}.size() > max_size()` @@ -2770,7 +2770,7 @@ std::basic_ostream& operator<<(std::basic_ostream& os, basic_static_string const& s) { - return os << string_view(s.data(), s.size()); + return os << basic_string_view(s.data(), s.size()); } //------------------------------------------------------------------------------ diff --git a/test/static_string.cpp b/test/static_string.cpp index 098cef6..714b7e3 100644 --- a/test/static_string.cpp +++ b/test/static_string.cpp @@ -16,6 +16,7 @@ namespace boost { namespace static_string { +using string_view = basic_string_view>; template bool @@ -6933,7 +6934,6 @@ constexpr bool testConstexpr() #elif __cplusplus >= 201402L // c++14 constexpr tests - static_string<4> a; using S = basic_static_string<16, char, cxper_char_traits>; @@ -6963,7 +6963,7 @@ constexpr bool testConstexpr() #else __cplusplus >= 201103L // c++11 constexpr tests - static_string<4> a; + static_string<4, char, cxper_char_traits> a; auto b = a.size(); auto c = a.empty(); auto d = a.empty(); @@ -7007,6 +7007,9 @@ runTests() testHash(); + static_string<1>() + static_string<3>(); + static_string<3>() + "ggggg"; + return report_errors(); }