Move string_view literal operators to str_literals namespace

This commit is contained in:
rexy712 2022-06-19 11:39:54 -07:00
parent d5a0f1927d
commit e5d8c0f567

View File

@ -133,27 +133,30 @@ namespace rexy{
extern template class basic_string_view<char32_t>;
#endif
inline namespace str_literals{
constexpr inline rexy::basic_string_view<char> operator"" _sv(const char* str, size_t len)noexcept{
return rexy::basic_string_view(str, len);
}
constexpr inline rexy::basic_string_view<wchar_t> operator"" _sv(const wchar_t* str, size_t len)noexcept{
return rexy::basic_string_view(str, len);
}
constexpr inline rexy::basic_string_view<char16_t> operator"" _sv(const char16_t* str, size_t len)noexcept{
return rexy::basic_string_view(str, len);
}
constexpr inline rexy::basic_string_view<char32_t> operator"" _sv(const char32_t* str, size_t len)noexcept{
return rexy::basic_string_view(str, len);
}
}
}
namespace{
constexpr inline rexy::basic_string_view<char> operator"" _sv(const char* str, size_t len)noexcept{
return rexy::basic_string_view(str, len);
}
constexpr inline rexy::basic_string_view<wchar_t> operator"" _sv(const wchar_t* str, size_t len)noexcept{
return rexy::basic_string_view(str, len);
}
constexpr inline rexy::basic_string_view<char16_t> operator"" _sv(const char16_t* str, size_t len)noexcept{
return rexy::basic_string_view(str, len);
}
constexpr inline rexy::basic_string_view<char32_t> operator"" _sv(const char32_t* str, size_t len)noexcept{
return rexy::basic_string_view(str, len);
}
template<class Char>
std::ostream& operator<<(std::ostream& os, const rexy::basic_string_view<Char>& str){
return os << str.c_str();
}
}
#include "string_view.tpp"