10 #ifndef SRC_INCLUDE_SMASH_TRAITS_H_
11 #define SRC_INCLUDE_SMASH_TRAITS_H_
15 #include <type_traits>
30 template <
typename S,
typename T,
typename =
void>
39 template <
typename S,
typename T>
41 S, T, std::void_t<decltype(std::declval<S&>() << std::declval<T>())>>
47 template <typename S, typename T>
48 inline constexpr bool is_writable_to_stream_v =
49 is_writable_to_stream<S, T>::value;
59 template <typename T, typename Enable = void>
60 struct has_to_string : std::false_type {};
79 struct has_to_string<T,
80 std::void_t<decltype(smash::to_string(std::declval<T>()))>>
81 : std::is_same<decltype(smash::to_string(std::declval<T>())), std::string> {
93 template <std::size_t N>
94 struct has_to_string<std::bitset<N>, std::void_t<decltype(smash::to_string(
95 std::declval<std::bitset<N>>()))>>
96 : std::is_same<decltype(smash::to_string(std::declval<std::bitset<N>>())),
97 std::vector<std::string>> {};
102 template <typename T>
103 inline constexpr bool has_to_string_v = has_to_string<T>::value;
Type trait to infer if a type can be streamed via the << operator.