matches.hpp 345 B

123456789101112131415161718
  1. #pragma once
  2. namespace matcher {
  3. template <typename Pred>
  4. struct predicate_t {
  5. Pred predicate;
  6. };
  7. template <typename T, typename Pred>
  8. bool operator==(T const & t, predicate_t<Pred> const & of) {
  9. return of.predicate(t);
  10. }
  11. template <typename Pred>
  12. predicate_t<Pred> matches(Pred && args) {
  13. return {args};
  14. }
  15. }