From e5d8c0f56701b51136a030048436c70ac474ce1a Mon Sep 17 00:00:00 2001 From: rexy712 Date: Sun, 19 Jun 2022 11:39:54 -0700 Subject: [PATCH] Move string_view literal operators to str_literals namespace --- include/rexy/string_view.hpp | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/include/rexy/string_view.hpp b/include/rexy/string_view.hpp index 3d9d1cd..82ff986 100644 --- a/include/rexy/string_view.hpp +++ b/include/rexy/string_view.hpp @@ -133,27 +133,30 @@ namespace rexy{ extern template class basic_string_view; #endif + inline namespace str_literals{ + + constexpr inline rexy::basic_string_view operator"" _sv(const char* str, size_t len)noexcept{ + return rexy::basic_string_view(str, len); + } + constexpr inline rexy::basic_string_view operator"" _sv(const wchar_t* str, size_t len)noexcept{ + return rexy::basic_string_view(str, len); + } + constexpr inline rexy::basic_string_view operator"" _sv(const char16_t* str, size_t len)noexcept{ + return rexy::basic_string_view(str, len); + } + constexpr inline rexy::basic_string_view operator"" _sv(const char32_t* str, size_t len)noexcept{ + return rexy::basic_string_view(str, len); + } + + } + } namespace{ - - constexpr inline rexy::basic_string_view operator"" _sv(const char* str, size_t len)noexcept{ - return rexy::basic_string_view(str, len); - } - constexpr inline rexy::basic_string_view operator"" _sv(const wchar_t* str, size_t len)noexcept{ - return rexy::basic_string_view(str, len); - } - constexpr inline rexy::basic_string_view operator"" _sv(const char16_t* str, size_t len)noexcept{ - return rexy::basic_string_view(str, len); - } - constexpr inline rexy::basic_string_view operator"" _sv(const char32_t* str, size_t len)noexcept{ - return rexy::basic_string_view(str, len); - } template std::ostream& operator<<(std::ostream& os, const rexy::basic_string_view& str){ return os << str.c_str(); } - } #include "string_view.tpp"