Add explicit template instantiation strings for different char types. add operator _ss overloads for different char types

This commit is contained in:
rexy712 2020-08-03 13:28:11 -07:00
parent f7b0822dd2
commit d98c40dac8
5 changed files with 48 additions and 0 deletions

View File

@ -28,6 +28,9 @@ namespace rexy{
using string = basic_string<char,detail::default_allocator<char>>;
extern template class basic_string<char,detail::default_allocator<char>>;
extern template class basic_string<wchar_t,detail::default_allocator<wchar_t>>;
extern template class basic_string<char16_t,detail::default_allocator<char16_t>>;
extern template class basic_string<char32_t,detail::default_allocator<char32_t>>;
}

View File

@ -306,6 +306,16 @@ namespace{
constexpr inline rexy::static_string<char> operator"" _ss(const char* str, size_t len)noexcept{
return rexy::static_string<char>(str, len);
}
constexpr inline rexy::static_string<wchar_t> operator"" _ss(const wchar_t* str, size_t len)noexcept{
return rexy::static_string<wchar_t>(str, len);
}
constexpr inline rexy::static_string<char16_t> operator"" _ss(const char16_t* str, size_t len)noexcept{
return rexy::static_string<char16_t>(str, len);
}
constexpr inline rexy::static_string<char32_t> operator"" _ss(const char32_t* str, size_t len)noexcept{
return rexy::static_string<char32_t>(str, len);
}
}
#ifdef REXY_BINARY_BASE_HPP

View File

@ -288,6 +288,10 @@ namespace rexy{
return *this;
}
extern template class static_string<char>;
extern template class static_string<wchar_t>;
extern template class static_string<char16_t>;
extern template class static_string<char32_t>;
} //namespace rexy

28
src/static_string.cpp Normal file
View File

@ -0,0 +1,28 @@
/**
This file is a part of rexy's general purpose library
Copyright (C) 2020 rexy712
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "rexy/static_string.hpp"
namespace rexy{
template class static_string<char>;
template class static_string<wchar_t>;
template class static_string<char16_t>;
template class static_string<char32_t>;
}

View File

@ -22,5 +22,8 @@
namespace rexy{
template class basic_string<char,detail::default_allocator<char>>;
template class basic_string<wchar_t,detail::default_allocator<wchar_t>>;
template class basic_string<char16_t,detail::default_allocator<char16_t>>;
template class basic_string<char32_t,detail::default_allocator<char32_t>>;
}