predicate.qbk 499 B

123456789101112131415161718192021222324
  1. [#predicate]
  2. [section Predicate]
  3. A ['predicate] (or unary predicate) is a
  4. [link metafunction_class template metafunction class] taking one argument and
  5. returning a [link boxed_value boxed value] of type `bool`.
  6. For example the following predicate checks if its argument is the boxed `char`
  7. value `x`:
  8. struct is_x
  9. {
  10. template <class C>
  11. struct apply
  12. {
  13. static constexpr bool value = (C::value == 'x');
  14. using type = apply;
  15. };
  16. using type = is_x;
  17. };
  18. [endsect]