From 11dbb1cb5a3b78b09a5a8abd83bb267c8e3cc6b3 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Tue, 12 May 2015 21:26:05 -0600 Subject: [PATCH] Add char16_t and char32_t to the list of literal string types. Fixes bug 11265 in Boost.StringAlgo's join. --- include/boost/range/as_literal.hpp | 43 ++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/include/boost/range/as_literal.hpp b/include/boost/range/as_literal.hpp index 1c16e4a..5d8c436 100644 --- a/include/boost/range/as_literal.hpp +++ b/include/boost/range/as_literal.hpp @@ -25,6 +25,11 @@ #include #include + +#if !defined(BOOST_NO_CHAR16_T) || !defined(BOOST_NO_CHAR32_T) +#include // for std::char_traits +#endif + #ifndef BOOST_NO_CWCHAR #include #endif @@ -38,6 +43,20 @@ namespace boost return strlen( s ); } +#ifndef BOOST_NO_CHAR16_T + inline std::size_t length( const char16_t* s ) + { + return std::char_traits::length( s ); + } +#endif + +#ifndef BOOST_NO_CHAR32_T + inline std::size_t length( const char32_t* s ) + { + return std::char_traits::length( s ); + } +#endif + #ifndef BOOST_NO_CWCHAR inline std::size_t length( const wchar_t* s ) { @@ -61,6 +80,30 @@ namespace boost 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 inline bool is_char_ptr( wchar_t* ) {