Add char16_t and char32_t to the list of literal string types. Fixes bug 11265 in Boost.StringAlgo's join.

This commit is contained in:
Marshall Clow
2015-05-12 21:26:05 -06:00
parent e961e66909
commit 11dbb1cb5a

View File

@ -25,6 +25,11 @@
#include <boost/detail/workaround.hpp> #include <boost/detail/workaround.hpp>
#include <cstring> #include <cstring>
#if !defined(BOOST_NO_CHAR16_T) || !defined(BOOST_NO_CHAR32_T)
#include <string> // for std::char_traits
#endif
#ifndef BOOST_NO_CWCHAR #ifndef BOOST_NO_CWCHAR
#include <cwchar> #include <cwchar>
#endif #endif
@ -38,6 +43,20 @@ namespace boost
return strlen( s ); return strlen( s );
} }
#ifndef BOOST_NO_CHAR16_T
inline std::size_t length( const char16_t* s )
{
return std::char_traits<char16_t>::length( s );
}
#endif
#ifndef BOOST_NO_CHAR32_T
inline std::size_t length( const char32_t* s )
{
return std::char_traits<char32_t>::length( s );
}
#endif
#ifndef BOOST_NO_CWCHAR #ifndef BOOST_NO_CWCHAR
inline std::size_t length( const wchar_t* s ) inline std::size_t length( const wchar_t* s )
{ {
@ -61,6 +80,30 @@ namespace boost
return true; return true;
} }
#ifndef BOOST_NO_CHAR16_T
inline bool is_char_ptr( char16_t* )
{
return true;
}
inline bool is_char_ptr( const char16_t* )
{
return true;
}
#endif
#ifndef BOOST_NO_CHAR32_T
inline bool is_char_ptr( char32_t* )
{
return true;
}
inline bool is_char_ptr( const char32_t* )
{
return true;
}
#endif
#ifndef BOOST_NO_CWCHAR #ifndef BOOST_NO_CWCHAR
inline bool is_char_ptr( wchar_t* ) inline bool is_char_ptr( wchar_t* )
{ {