7#ifndef BOOST_NOWIDE_DETAIL_IS_STRING_CONTAINER_HPP_INCLUDED
8#define BOOST_NOWIDE_DETAIL_IS_STRING_CONTAINER_HPP_INCLUDED
23 using void_t =
typename make_void<Ts...>::type;
26 struct is_char_type : std::false_type
29 struct is_char_type<char> : std::true_type
32 struct is_char_type<wchar_t> : std::true_type
35 struct is_char_type<char16_t> : std::true_type
38 struct is_char_type<char32_t> : std::true_type
42 struct is_char_type<char8_t> : std::true_type
47 struct is_c_string : std::false_type
50 struct is_c_string<const T*> : is_char_type<T>
54 using const_data_result =
decltype(std::declval<const T>().data());
57 using get_data_width =
58 std::integral_constant<std::size_t,
sizeof(
typename std::remove_pointer<const_data_result<T>>::type)>;
60 using size_result =
decltype(std::declval<T>().size());
63 using has_narrow_data = std::integral_constant<bool, (get_data_width<T>::value == 1)>;
68 template<
typename T,
bool isNarrow,
typename =
void>
69 struct is_string_container : std::false_type
72 template<
typename T,
bool isNarrow>
73 struct is_string_container<T, isNarrow, void_t<decltype(T::npos), size_result<T>, const_data_result<T>>>
74 : std::integral_constant<bool,
75 std::is_integral<decltype(T::npos)>::value
76 && std::is_integral<size_result<T>>::value
77 && is_c_string<const_data_result<T>>::value
78 && isNarrow == has_narrow_data<T>::value>
82 using requires_narrow_string_container =
typename std::enable_if<is_string_container<T, true>::value>::type;
84 using requires_wide_string_container =
typename std::enable_if<is_string_container<T, false>::value>::type;
87 using requires_narrow_char =
typename std::enable_if<
sizeof(T) == 1 && is_char_type<T>::value>::type;
89 using requires_wide_char =
typename std::enable_if<(
sizeof(T) > 1) && is_char_type<T>::value>::type;