Hi, trying to use boost::trim() with std::u16string gives a compilation error
environment: Android NDK 16, clang + c++_static, boost verison is 1.65.1 (same with older versions like 1.59)
here is the code:
#include <boost/algorithm/string.hpp>
#include <string>
...
std::u16string str; //using std::string is fine
boost::trim(str);
the error:
In file included from jni/main.cpp:4:
In file included from /home/tsvetan/work/OfficeCppWin/libs/vendor/boost/boost/algorithm/string.hpp:19:
In file included from /home/tsvetan/work/OfficeCppWin/libs/vendor/boost/boost/algorithm/string/trim.hpp:23:
In file included from /home/tsvetan/work/OfficeCppWin/libs/vendor/boost/boost/algorithm/string/classification.hpp:18:
/home/tsvetan/work/OfficeCppWin/libs/vendor/boost/boost/algorithm/string/detail/classification.hpp:45:73: error: implicit instantiation of undefined template 'std::__ndk1::ctype<char32_t>'
return std::use_facet< std::ctype<CharT> >(m_Locale).is( m_Type, Ch );
^
/home/tsvetan/work/OfficeCppWin/libs/vendor/boost/boost/algorithm/string/detail/trim.hpp:53:27: note: in instantiation of function template specialization 'boost::algorithm::detail::is_classifiedF::operator()<char32_t>' requested here
if ( !IsSpace(*(--It)) )
^
/home/tsvetan/work/OfficeCppWin/libs/vendor/boost/boost/algorithm/string/detail/trim.hpp:86:52: note: in instantiation of function template specialization 'boost::algorithm::detail::trim_end_iter_select<std::__ndk1::__wrap_iter<char32_t *>, boost::algorithm::detail::is_classifiedF>' requested here
return ::boost::algorithm::detail::trim_end_iter_select( InBegin, InEnd, IsSpace, category() );
^
/home/tsvetan/work/OfficeCppWin/libs/vendor/boost/boost/algorithm/string/trim.hpp:237:45: note: in instantiation of function template specialization 'boost::algorithm::detail::trim_end<std::__ndk1::__wrap_iter<char32_t *>, boost::algorithm::detail::is_classifiedF>' requested here
::boost::algorithm::detail::trim_end(
^
/home/tsvetan/work/OfficeCppWin/libs/vendor/boost/boost/algorithm/string/trim.hpp:360:33: note: in instantiation of function template specialization 'boost::algorithm::trim_right_if<std::__ndk1::basic_string<char32_t, std::__ndk1::char_traits<char32_t>, std::__ndk1::allocator<char32_t> >, boost::algorithm::detail::is_classifiedF>' requested here
::boost::algorithm::trim_right_if( Input, IsSpace );
^
/home/tsvetan/work/OfficeCppWin/libs/vendor/boost/boost/algorithm/string/trim.hpp:375:33: note: in instantiation of function template specialization 'boost::algorithm::trim_if<std::__ndk1::basic_string<char32_t, std::__ndk1::char_traits<char32_t>, std::__ndk1::allocator<char32_t> >, boost::algorithm::detail::is_classifiedF>' requested here
::boost::algorithm::trim_if(
^
jni/main.cpp:21:12: note: in instantiation of function template specialization 'boost::algorithm::trim<std::__ndk1::basic_string<char32_t, std::__ndk1::char_traits<char32_t>, std::__ndk1::allocator<char32_t> > >' requested here
boost::trim(u16str);
^
/home/tsvetan/devToolsLinux/android-ndk-r16/sources/cxx-stl/llvm-libc++/include/__locale:453:52: note: template is declared here
template <class _CharT> class _LIBCPP_TEMPLATE_VIS ctype;
^
/home/tsvetan/devToolsLinux/android-ndk-r16/sources/cxx-stl/llvm-libc++/include/__locale:212:54: error: implicit instantiation of undefined template 'std::__ndk1::ctype<char32_t>'
return static_cast<const _Facet&>(*__l.use_facet(_Facet::id));
^
/home/tsvetan/work/OfficeCppWin/libs/vendor/boost/boost/algorithm/string/detail/classification.hpp:45:33: note: in instantiation of function template specialization 'std::__ndk1::use_facet<std::__ndk1::ctype<char32_t> >' requested here
return std::use_facet< std::ctype<CharT> >(m_Locale).is( m_Type, Ch );
^
/home/tsvetan/work/OfficeCppWin/libs/vendor/boost/boost/algorithm/string/detail/trim.hpp:53:27: note: in instantiation of function template specialization 'boost::algorithm::detail::is_classifiedF::operator()<char32_t>' requested here
if ( !IsSpace(*(--It)) )
^
/home/tsvetan/work/OfficeCppWin/libs/vendor/boost/boost/algorithm/string/detail/trim.hpp:86:52: note: in instantiation of function template specialization 'boost::algorithm::detail::trim_end_iter_select<std::__ndk1::__wrap_iter<char32_t *>, boost::algorithm::detail::is_classifiedF>' requested here
return ::boost::algorithm::detail::trim_end_iter_select( InBegin, InEnd, IsSpace, category() );
^
/home/tsvetan/work/OfficeCppWin/libs/vendor/boost/boost/algorithm/string/trim.hpp:237:45: note: in instantiation of function template specialization 'boost::algorithm::detail::trim_end<std::__ndk1::__wrap_iter<char32_t *>, boost::algorithm::detail::is_classifiedF>' requested here
::boost::algorithm::detail::trim_end(
^
/home/tsvetan/work/OfficeCppWin/libs/vendor/boost/boost/algorithm/string/trim.hpp:360:33: note: in instantiation of function template specialization 'boost::algorithm::trim_right_if<std::__ndk1::basic_string<char32_t, std::__ndk1::char_traits<char32_t>, std::__ndk1::allocator<char32_t> >, boost::algorithm::detail::is_classifiedF>' requested here
::boost::algorithm::trim_right_if( Input, IsSpace );
^
/home/tsvetan/work/OfficeCppWin/libs/vendor/boost/boost/algorithm/string/trim.hpp:375:33: note: in instantiation of function template specialization 'boost::algorithm::trim_if<std::__ndk1::basic_string<char32_t, std::__ndk1::char_traits<char32_t>, std::__ndk1::allocator<char32_t> >, boost::algorithm::detail::is_classifiedF>' requested here
::boost::algorithm::trim_if(
^
jni/main.cpp:21:12: note: in instantiation of function template specialization 'boost::algorithm::trim<std::__ndk1::basic_string<char32_t, std::__ndk1::char_traits<char32_t>, std::__ndk1::allocator<char32_t> > >' requested here
boost::trim(u16str);
^
/home/tsvetan/devToolsLinux/android-ndk-r16/sources/cxx-stl/llvm-libc++/include/__locale:453:52: note: template is declared here
template <class _CharT> class _LIBCPP_TEMPLATE_VIS ctype;
^
In file included from jni/main.cpp:4:
In file included from /home/tsvetan/work/OfficeCppWin/libs/vendor/boost/boost/algorithm/string.hpp:19:
In file included from /home/tsvetan/work/OfficeCppWin/libs/vendor/boost/boost/algorithm/string/trim.hpp:22:
/home/tsvetan/work/OfficeCppWin/libs/vendor/boost/boost/algorithm/string/detail/trim.hpp:69:26: error: no matching function for call to object of type 'boost::algorithm::detail::is_classifiedF'
if (!IsSpace(*It))
^~~~~~~
/home/tsvetan/work/OfficeCppWin/libs/vendor/boost/boost/algorithm/string/trim.hpp:128:45: note: in instantiation of function template specialization 'boost::algorithm::detail::trim_begin<std::__ndk1::__wrap_iter<char32_t *>, boost::algorithm::detail::is_classifiedF>' requested here
::boost::algorithm::detail::trim_begin(
^
/home/tsvetan/work/OfficeCppWin/libs/vendor/boost/boost/algorithm/string/trim.hpp:361:33: note: in instantiation of function template specialization 'boost::algorithm::trim_left_if<std::__ndk1::basic_string<char32_t, std::__ndk1::char_traits<char32_t>, std::__ndk1::allocator<char32_t> >, boost::algorithm::detail::is_classifiedF>' requested here
::boost::algorithm::trim_left_if( Input, IsSpace );
^
/home/tsvetan/work/OfficeCppWin/libs/vendor/boost/boost/algorithm/string/trim.hpp:375:33: note: in instantiation of function template specialization 'boost::algorithm::trim_if<std::__ndk1::basic_string<char32_t, std::__ndk1::char_traits<char32_t>, std::__ndk1::allocator<char32_t> >, boost::algorithm::detail::is_classifiedF>' requested here
::boost::algorithm::trim_if(
^
jni/main.cpp:21:12: note: in instantiation of function template specialization 'boost::algorithm::trim<std::__ndk1::basic_string<char32_t, std::__ndk1::char_traits<char32_t>, std::__ndk1::allocator<char32_t> > >' requested here
boost::trim(u16str);
^
/home/tsvetan/work/OfficeCppWin/libs/vendor/boost/boost/algorithm/string/detail/classification.hpp:43:22: note: candidate template ignored: substitution failure [with CharT = char32_t]
bool operator()( CharT Ch ) const
^
3 errors generated.
make: *** [obj/local/armeabi-v7a/objs-debug/main/main.o] Error 1