Akonadi
17struct conjunction : std::true_type {
20struct conjunction<T> : T {
22template<
typename T,
typename... Ts>
23struct conjunction<T, Ts...> : std::conditional_t<bool(T::value), conjunction<Ts...>, T> {
26#define DECLARE_HAS_MEBER_TYPE(type_name) \
27 template<typename T, typename U = std::void_t<>> \
28 struct hasMember_##type_name { \
29 static constexpr bool value = false; \
32 template<typename T> \
33 struct hasMember_##type_name<T, std::void_t<typename T::type_name>> : std::true_type { \
36DECLARE_HAS_MEBER_TYPE(value_type)
39#define DECLARE_HAS_METHOD_GENERIC_IMPL(name, fun, sign) \
40 template<typename T, typename F = sign> \
41 struct hasMethod_##name { \
43 template<typename UType, UType> \
47 using False = struct { \
51 template<typename U> \
52 static True helper(helperClass<F, &U::fun> *); \
54 static False helper(...); \
57 static constexpr bool value = sizeof(helper<T>(nullptr)) == sizeof(True); \
60#define DECLARE_HAS_METHOD_GENERIC_CONST(fun, R, ...) DECLARE_HAS_METHOD_GENERIC_IMPL(fun##_const, fun, R (T::*)(__VA_ARGS__) const)
62#define DECLARE_HAS_METHOD_GENERIC(fun, R, ...) DECLARE_HAS_METHOD_GENERIC_IMPL(fun, fun, R (T::*)(__VA_ARGS__))
65template<
typename T,
typename = std::
void_t<>>
66struct parameter_type {
67 typedef const typename T::value_type &type;
70struct parameter_type<T,
std::void_t<typename T::parameter_type>> {
71 typedef typename T::parameter_type type;
74DECLARE_HAS_METHOD_GENERIC_CONST(size, qsizetype,
void)
75DECLARE_HAS_METHOD_GENERIC(push_back,
void,
typename parameter_type<T>::type)
76DECLARE_HAS_METHOD_GENERIC(insert,
typename T::iterator,
typename parameter_type<T>::type)
77DECLARE_HAS_METHOD_GENERIC(reserve,
void, qsizetype)
79#define DECLARE_HAS_FUNCTION(name, fun) \
80 template<typename T> \
82 template<typename U> \
86 using False = struct { \
90 template<typename U> \
91 static True helper(helperClass<decltype(fun(std::declval<T>()))> *); \
93 static False helper(...); \
96 static constexpr bool value = sizeof(helper<T>(nullptr)) == sizeof(True); \
104DECLARE_HAS_FUNCTION(begin, std::begin)
105DECLARE_HAS_FUNCTION(end, std::end)
112 : conjunction<std::is_constructible<T>, hasMember_value_type<T>, has_begin<T>, has_begin<const T>, has_end<T>, has_end<const T>, hasMethod_size_const<T>> {
117struct isAppendable : conjunction<isContainer<T>, hasMethod_push_back<T>> {
122struct isInsertable : conjunction<isContainer<T>, hasMethod_insert<T>> {
127struct isReservable : conjunction<isContainer<T>, hasMethod_reserve<T>> {
142#define AK_PP_CAT_(X, Y) X##Y
143#define AK_PP_CAT(X, Y) AK_PP_CAT_(X, Y)
145#define AK_REQUIRES(...) bool AK_PP_CAT(_ak_requires_, __LINE__) = false, std::enable_if_t < AK_PP_CAT(_ak_requires_, __LINE__) || (__VA_ARGS__) > * = nullptr
A glue between Qt and the standard library.
Matches anything that is a container and has push_back() method.
This is a very incomplete set of Container named requirement, but I'm too lazy to implement all of th...
Matches anything that is a container and has insert() method.
Matches anything that is a container and has reserve() method.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:13:38 by
doxygen 1.10.0 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.