1 // Copyright (c) 2009-2020 Vladimir Batov.
2 // Use, modification and distribution are subject to the Boost Software License,
3 // Version 1.0. See http://www.boost.org/LICENSE_1_0.txt.
5 #ifndef BOOST_CONVERT_DETAIL_IS_CHAR_HPP
6 #define BOOST_CONVERT_DETAIL_IS_CHAR_HPP
8 #include <boost/convert/detail/config.hpp>
12 namespace boost { namespace cnv
14 using char_type = char;
15 using uchar_type = unsigned char;
16 using wchar_type = wchar_t;
20 template<typename> struct is_char : std::false_type {};
21 template<> struct is_char< char_type> : std:: true_type {};
22 template<> struct is_char<wchar_type> : std:: true_type {};
24 template <typename T> struct is_char : detail::is_char<typename boost::remove_const<T>::type> {};
26 template<typename char_type> inline bool is_space(char_type);
27 template<typename char_type> inline char_type to_upper(char_type);
29 template<> inline bool is_space ( char_type c) { return bool(std::isspace(static_cast<uchar_type>(c))); }
30 template<> inline bool is_space (uchar_type c) { return bool(std::isspace(c)); }
31 template<> inline bool is_space (wchar_type c) { return bool(std::iswspace(c)); }
32 template<> inline char_type to_upper ( char_type c) { return std::toupper(static_cast<uchar_type>(c)); }
33 template<> inline uchar_type to_upper (uchar_type c) { return std::toupper(c); }
34 template<> inline wchar_type to_upper (wchar_type c) { return std::towupper(c); }
37 #endif // BOOST_CONVERT_DETAIL_IS_CHAR_HPP