is_string.hpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. // Copyright (c) 2009-2016 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.
  4. #ifndef BOOST_CONVERT_DETAIL_IS_STRING_HPP
  5. #define BOOST_CONVERT_DETAIL_IS_STRING_HPP
  6. #include <boost/convert/detail/range.hpp>
  7. namespace boost { namespace cnv
  8. {
  9. namespace detail
  10. {
  11. template<typename T, bool is_range_class> struct is_string : std::false_type {};
  12. template<typename T> struct is_string<T*, false>
  13. {
  14. static bool const value = cnv::is_char<T>::value;
  15. };
  16. template <typename T, std::size_t N> struct is_string<T [N], false>
  17. {
  18. static bool const value = cnv::is_char<T>::value;
  19. };
  20. template<typename T> struct is_string<T, /*is_range_class=*/true>
  21. {
  22. static bool const value = cnv::is_char<typename T::value_type>::value;
  23. };
  24. }
  25. template<typename T> struct is_string : detail::is_string<
  26. typename boost::remove_const<T>::type,
  27. boost::is_class<T>::value && boost::cnv::is_range<T>::value> {};
  28. }}
  29. #endif // BOOST_CONVERT_DETAIL_IS_STRING_HPP