|
|
|
@ -9,7 +9,11 @@
|
|
|
|
|
|
|
|
|
|
namespace pEp
|
|
|
|
|
{
|
|
|
|
|
typedef std::string_view string_view;
|
|
|
|
|
template<class CharT>
|
|
|
|
|
using basic_string_view = std::basic_string_view<CharT>;
|
|
|
|
|
|
|
|
|
|
typedef std::string_view string_view;
|
|
|
|
|
typedef std::u16string_view u16string_view;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#else // in C++11 / C++14 use boost::string_view instead.
|
|
|
|
@ -17,18 +21,24 @@ namespace pEp
|
|
|
|
|
|
|
|
|
|
namespace pEp
|
|
|
|
|
{
|
|
|
|
|
typedef boost::string_view string_view;
|
|
|
|
|
template<class CharT>
|
|
|
|
|
using basic_string_view = boost::basic_string_view<CharT>;
|
|
|
|
|
|
|
|
|
|
typedef boost::string_view string_view;
|
|
|
|
|
typedef boost::u16string_view u16string_view;
|
|
|
|
|
|
|
|
|
|
// boost::string_view does not provide these operations, neither by boost nor by the stdlib. :-(
|
|
|
|
|
template<class CharT>
|
|
|
|
|
inline
|
|
|
|
|
std::string& operator+=(std::string& s, const string_view v)
|
|
|
|
|
std::basic_string<CharT>& operator+=(std::basic_string<CharT>& s, const basic_string_view<CharT> v)
|
|
|
|
|
{
|
|
|
|
|
s.append(v.data(), v.size());
|
|
|
|
|
return s;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<class CharT>
|
|
|
|
|
inline
|
|
|
|
|
std::string operator+(std::string s, const string_view v)
|
|
|
|
|
std::basic_string<CharT> operator+(std::basic_string<CharT> s, const basic_string_view<CharT> v)
|
|
|
|
|
{
|
|
|
|
|
return s += v;
|
|
|
|
|
}
|
|
|
|
|