17 template <
class T,
class Deleter>
35 template <
typename... Ts>
54 template <
unsigned...>
57 template <
unsigned N,
unsigned... Is>
60 template <
unsigned... Is>
65 template <
typename Test,
template <
typename...>
class Ref>
68 template <
template <
typename...>
class Ref,
typename... Args>
74 template <
typename S,
typename T>
77 template <
typename S,
typename T,
typename =
void>
80 template <
typename S,
typename T>
90 template <
typename T,
typename =
void>
100 decltype(std::declval<T>().find(std::declval<typename T::key_type>())),
101 decltype(std::declval<T>().insert(std::declval<typename T::value_type>()))>;
103 template <
typename T,
typename =
void>
106 template <
typename T>
110 #if ZEROERR_CXX_STANDARD >= 17
111 #define ZEROERR_STRING_VIEW std::is_same<T, std::string_view>::value
113 #define ZEROERR_STRING_VIEW 0
119 : std::integral_constant<bool, std::is_same<T, std::string>::value ||
120 std::is_same<T, const char*>::value || ZEROERR_STRING_VIEW> {
125 template <
typename T,
typename =
void>
128 template <
typename T>
133 template <
typename T>
136 decltype(std::declval<typename T::value_type>().second)>;
137 template <
typename T,
typename =
void>
140 template <
typename T>
143 template <
typename T,
typename V =
void>
158 template <
typename T>
159 using is_not_array =
typename std::enable_if<!std::is_array<T>::value>::type;
160 template <
typename T>
165 template <
typename T>
170 template <
typename T>
176 template <
typename T,
typename F>
177 static void visit(T& tup,
size_t idx, F&& fun) {
179 fun(std::get<I - 1>(tup));
187 template <
typename T,
typename F>
188 static void visit(T&,
size_t, F&&) {}
191 template <
typename F,
typename... Ts>
192 void visit_at(
const std::tuple<Ts...>& tup,
size_t idx, F&& fun) {
193 visit_impl<
sizeof...(Ts)>::visit(tup, idx, std::forward<F>(fun));
196 template <
typename F,
typename... Ts>
197 void visit_at(std::tuple<Ts...>& tup,
size_t idx, F&& fun) {
198 visit_impl<
sizeof...(Ts)>::visit(tup, idx, std::forward<F>(fun));
204 template <
typename T1,
typename T2,
typename F>
205 static void visit(T1 tup1, T2 tup2,
size_t idx, F&& fun) {
207 fun(std::get<I - 1>(tup1), std::get<I - 1>(tup2));
215 template <
typename T1,
typename T2,
typename F>
216 static void visit(T1&, T2&,
size_t, F&&) {}
219 template <
typename F,
typename... Ts,
typename... T2s>
220 void visit2_at(
const std::tuple<Ts...>& tup1,
const std::tuple<T2s...>& tup2,
size_t idx, F&& fun) {
221 visit2_impl<
sizeof...(Ts)>::visit(tup1, tup2, idx, std::forward<F>(fun));
224 template <
typename F,
typename... Ts,
typename... T2s>
225 void visit2_at(std::tuple<Ts...>& tup1, std::tuple<T2s...>& tup2,
size_t idx, F&& fun) {
226 visit2_impl<
sizeof...(Ts)>::visit(tup1, tup2, idx, std::forward<F>(fun));
229 template <
typename F,
typename... Ts,
typename... T2s>
230 void visit2_at(
const std::tuple<Ts...>& tup1, std::tuple<T2s...>& tup2,
size_t idx, F&& fun) {
231 visit2_impl<
sizeof...(Ts)>::visit(tup1, tup2, idx, std::forward<F>(fun));
234 template <
typename F,
typename... Ts,
typename... T2s>
235 void visit2_at(std::tuple<Ts...>& tup1,
const std::tuple<T2s...>& tup2,
size_t idx, F&& fun) {
236 visit2_impl<
sizeof...(Ts)>::visit(tup1, tup2, idx, std::forward<F>(fun));
239 #define ZEROERR_ENABLE_IF(x) \
240 template <typename T> \
241 typename std::enable_if<x, void>::type
242 #define ZEROERR_IS_INT std::is_integral<T>::value
243 #define ZEROERR_IS_FLOAT std::is_floating_point<T>::value
244 #define ZEROERR_IS_CONTAINER detail::is_container<T>::value
245 #define ZEROERR_IS_STRING detail::is_string<T>::value
246 #define ZEROERR_IS_POINTER std::is_pointer<T>::value
247 #define ZEROERR_IS_CHAR std::is_same<T, char>::value
248 #define ZEROERR_IS_WCHAR std::is_same<T, wchar_t>::value
249 #define ZEROERR_IS_CLASS std::is_class<T>::value
250 #define ZEROERR_IS_STREAMABLE detail::is_streamable<std::ostream, T>::value
251 #define ZEROERR_IS_ARRAY detail::is_array<T>::value
252 #define ZEROERR_IS_COMPLEX detail::is_specialization<T, std::complex>::value
253 #define ZEROERR_IS_BOOL std::is_same<T, bool>::value
254 #define ZEROERR_IS_AUTOPTR \
255 (detail::is_specialization<T, std::unique_ptr>::value || \
256 detail::is_specialization<T, std::shared_ptr>::value || \
257 detail::is_specialization<T, std::weak_ptr>::value)
258 #define ZEROERR_IS_MAP detail::ele_type_is_pair<T>::value
259 #define ZEROERR_IS_POD std::is_standard_layout<T>::value
260 #define ZEROERR_IS_EXT detail::has_extension<T>::value
#define ZEROERR_SUPPRESS_COMMON_WARNINGS_POP
Definition: config.h:265
#define ZEROERR_SUPPRESS_COMMON_WARNINGS_PUSH
Definition: config.h:218
void_t< typename T::value_type, decltype(std::declval< typename T::value_type >().first), decltype(std::declval< typename T::value_type >().second)> has_pair_type
Definition: typetraits.h:136
typename to_store_type< T >::type to_store_type_t
Definition: typetraits.h:171
void_t< decltype(std::declval< S & >()<< std::declval< T >())> has_stream_operator
Definition: typetraits.h:75
void_t< decltype(std::declval< T >().begin()), decltype(std::declval< T >().end()), decltype(std::declval< T >().find(std::declval< typename T::key_type >())), decltype(std::declval< T >().insert(std::declval< typename T::value_type >()))> has_begin_end_find_insert
Definition: typetraits.h:101
void_t< decltype(std::declval< T >().begin()), decltype(std::declval< T >().end())> has_begin_end
Definition: typetraits.h:88
void void_t
Definition: typetraits.h:36
typename std::enable_if<!std::is_array< T >::value >::type is_not_array
Definition: typetraits.h:159
void visit_at(const std::tuple< Ts... > &tup, size_t idx, F &&fun)
Definition: typetraits.h:192
void visit2_at(const std::tuple< Ts... > &tup1, const std::tuple< T2s... > &tup2, size_t idx, F &&fun)
Definition: typetraits.h:220
Definition: benchmark.cpp:17
Definition: typetraits.h:42
static std::false_type value
Definition: typetraits.h:43
Definition: typetraits.h:47
static std::true_type value
Definition: typetraits.h:48
Definition: typetraits.h:138
Definition: typetraits.h:58
Definition: typetraits.h:126
Definition: typetraits.h:104
Definition: typetraits.h:91
Definition: typetraits.h:66
Definition: typetraits.h:78
Definition: typetraits.h:120
Definition: typetraits.h:55
T type
Definition: typetraits.h:162
T type
Definition: typetraits.h:167
std::string type
Definition: typetraits.h:150
std::string type
Definition: typetraits.h:155
Definition: typetraits.h:144
T type
Definition: typetraits.h:145
static void visit(T1 &, T2 &, size_t, F &&)
Definition: typetraits.h:216
Definition: typetraits.h:203
static void visit(T1 tup1, T2 tup2, size_t idx, F &&fun)
Definition: typetraits.h:205
static void visit(T &, size_t, F &&)
Definition: typetraits.h:188
Definition: typetraits.h:175
static void visit(T &tup, size_t idx, F &&fun)
Definition: typetraits.h:177