Skip to content

Instantly share code, notes, and snippets.

@picanumber
Last active December 21, 2016 19:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save picanumber/328b0040ecb92e848f1819db150f8f1b to your computer and use it in GitHub Desktop.
Save picanumber/328b0040ecb92e848f1819db150f8f1b to your computer and use it in GitHub Desktop.
Quantifiers as concepts
// -----------------------------------------------------------
// -------------------- 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