Last active
December 21, 2016 19:25
-
-
Save picanumber/328b0040ecb92e848f1819db150f8f1b to your computer and use it in GitHub Desktop.
Quantifiers as concepts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ----------------------------------------------------------- | |
// -------------------- to express "1 predicate Vs many types" | |
template <template <class> class P, class... Ts> | |
concept bool existential_quantifier = any_v<P<Ts>::value...>; | |
template <template <class> class P, class... Ts> | |
concept bool universal_quantifier = all_v<P<Ts>::value...>; | |
// ----------------------------------------------------------- | |
// ----------------------------------------------------------- | |
// -------------------- to express "1 type Vs many predicates" | |
template <class T, template <class> class... Ps> | |
concept bool satisfies_all = all_v<Ps<T>...>; | |
template <class T, template <class> class... Ps> | |
concept bool satisfies_any = any_v<Ps<T>...>::value; | |
// ----------------------------------------------------------- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment