|
1 | | -#pragma once |
2 | | - |
3 | | -#include "../functional/cxx_type_traits_polyfill.h" |
4 | | -#include "../functional/mpl.h" |
5 | | - |
6 | | -namespace sqlite_orm { |
7 | | - // convenience metafunction algorithms |
8 | | - namespace internal { |
9 | | - /* |
10 | | - * Higher-order trait metafunction that checks whether a tuple contains a type with given trait (possibly projected). |
11 | | - */ |
12 | | - template<class Pack, |
13 | | - template<class...> |
14 | | - class TraitFn, |
15 | | - template<class...> class ProjOp = polyfill::type_identity_t> |
16 | | - using tuple_has = mpl::invoke_t<check_if_has<TraitFn>, Pack, mpl::quote_fn<ProjOp>>; |
17 | | - |
18 | | - /* |
19 | | - * Higher-order trait metafunction that checks whether a tuple contains the specified type (possibly projected). |
20 | | - */ |
21 | | - template<class Pack, class Type, template<class...> class ProjOp = polyfill::type_identity_t> |
22 | | - using tuple_has_type = mpl::invoke_t<check_if_has_type<Type>, Pack, mpl::quote_fn<ProjOp>>; |
23 | | - |
24 | | - /* |
25 | | - * Higher-order trait metafunction that checks whether a tuple contains the specified class template (possibly projected). |
26 | | - */ |
27 | | - template<class Pack, |
28 | | - template<class...> |
29 | | - class Template, |
30 | | - template<class...> class ProjOp = polyfill::type_identity_t> |
31 | | - using tuple_has_template = mpl::invoke_t<check_if_has_template<Template>, Pack, mpl::quote_fn<ProjOp>>; |
32 | | - |
33 | | - /* |
34 | | - * Higher-order metafunction returning the first index constant of the desired type in a tuple (possibly projected). |
35 | | - */ |
36 | | - template<class Pack, class Type, template<class...> class ProjOp = polyfill::type_identity_t> |
37 | | - using find_tuple_type = mpl::invoke_t<finds_if_has_type<Type>, Pack, mpl::quote_fn<ProjOp>>; |
38 | | - |
39 | | - /* |
40 | | - * Higher-order metafunction returning the first index constant of the desired class template in a tuple (possibly projected). |
41 | | - */ |
42 | | - template<class Pack, |
43 | | - template<class...> |
44 | | - class Template, |
45 | | - template<class...> class ProjOp = polyfill::type_identity_t> |
46 | | - using find_tuple_template = mpl::invoke_t<finds_if_has_template<Template>, Pack, mpl::quote_fn<ProjOp>>; |
47 | | - |
48 | | - /* |
49 | | - * Higher-order trait metafunction that counts the types having the specified trait in a tuple (possibly projected). |
50 | | - * |
51 | | - * `Pred` is a predicate metafunction with a nested bool member named `value` |
52 | | - * `Proj` is a metafunction |
53 | | - */ |
54 | | - template<class Pack, template<class...> class Pred, template<class...> class ProjOp = polyfill::type_identity_t> |
55 | | - using count_tuple = mpl::invoke_t<counts_if_has<Pred>, Pack, mpl::quote_fn<ProjOp>>; |
56 | | - } |
57 | | -} |
| 1 | +#pragma once |
| 2 | + |
| 3 | +#include "../functional/cxx_type_traits_polyfill.h" |
| 4 | +#include "../functional/mpl.h" |
| 5 | + |
| 6 | +namespace sqlite_orm { |
| 7 | + // convenience metafunction algorithms |
| 8 | + namespace internal { |
| 9 | + /* |
| 10 | + * Higher-order trait metafunction that checks whether a tuple contains a type with given trait (possibly projected). |
| 11 | + */ |
| 12 | + template<class Pack, |
| 13 | + template<class...> |
| 14 | + class TraitFn, |
| 15 | + template<class...> class ProjOp = polyfill::type_identity_t> |
| 16 | + using tuple_has = mpl::invoke_t<check_if_has<TraitFn>, Pack, mpl::quote_fn<ProjOp>>; |
| 17 | + |
| 18 | + /* |
| 19 | + * Higher-order trait metafunction that checks whether a tuple contains the specified type (possibly projected). |
| 20 | + */ |
| 21 | + template<class Pack, class Type, template<class...> class ProjOp = polyfill::type_identity_t> |
| 22 | + using tuple_has_type = mpl::invoke_t<check_if_has_type<Type>, Pack, mpl::quote_fn<ProjOp>>; |
| 23 | + |
| 24 | + /* |
| 25 | + * Higher-order trait metafunction that checks whether a tuple contains the specified class template (possibly projected). |
| 26 | + */ |
| 27 | + template<class Pack, |
| 28 | + template<class...> |
| 29 | + class Template, |
| 30 | + template<class...> class ProjOp = polyfill::type_identity_t> |
| 31 | + using tuple_has_template = mpl::invoke_t<check_if_has_template<Template>, Pack, mpl::quote_fn<ProjOp>>; |
| 32 | + |
| 33 | + /* |
| 34 | + * Higher-order metafunction returning the first index constant of the desired type in a tuple (possibly projected). |
| 35 | + */ |
| 36 | + template<class Pack, class Type, template<class...> class ProjOp = polyfill::type_identity_t> |
| 37 | + using find_tuple_type = mpl::invoke_t<finds_if_has_type<Type>, Pack, mpl::quote_fn<ProjOp>>; |
| 38 | + |
| 39 | + /* |
| 40 | + * Higher-order metafunction returning the first index constant of the desired class template in a tuple (possibly projected). |
| 41 | + */ |
| 42 | + template<class Pack, |
| 43 | + template<class...> |
| 44 | + class Template, |
| 45 | + template<class...> class ProjOp = polyfill::type_identity_t> |
| 46 | + using find_tuple_template = mpl::invoke_t<finds_if_has_template<Template>, Pack, mpl::quote_fn<ProjOp>>; |
| 47 | + |
| 48 | + /* |
| 49 | + * Higher-order trait metafunction that counts the types having the specified trait in a tuple (possibly projected). |
| 50 | + * |
| 51 | + * `Pred` is a predicate metafunction with a nested bool member named `value` |
| 52 | + * `Proj` is a metafunction |
| 53 | + */ |
| 54 | + template<class Pack, template<class...> class Pred, template<class...> class ProjOp = polyfill::type_identity_t> |
| 55 | + using count_tuple = mpl::invoke_t<counts_if_has<Pred>, Pack, mpl::quote_fn<ProjOp>>; |
| 56 | + } |
| 57 | +} |
0 commit comments