6#ifndef MIMICPP_MATCHERS_COMMON_HPP
7#define MIMICPP_MATCHERS_COMMON_HPP
20 template <
typename Matcher>
24namespace mimicpp::detail::matches_hook
26 template <
typename Matcher,
typename T,
typename... Others>
28 constexpr bool matches_impl(
30 const Matcher& matcher,
36 } -> std::convertible_to<bool>;
39 return custom::matcher_traits<Matcher>{}.matches(matcher, target, others...);
42 template <
typename Matcher,
typename T,
typename... Others>
44 constexpr bool matches_impl(
45 [[maybe_unused]]
const priority_tag<0>,
46 const Matcher& matcher,
49 requires requires { { matcher.matches(target, others...) } -> std::convertible_to<bool>; }
51 return matcher.matches(target, others...);
54 constexpr priority_tag<1> maxTag;
56 constexpr auto matches = []<
typename Matcher,
typename T,
typename... Others>(
57 const Matcher& matcher,
62 matches_impl(maxTag, matcher, target, others...)
63 }-> std::convertible_to<bool>; }
65 return matches_impl(maxTag, matcher, target, others...);
69namespace mimicpp::detail::describe_hook
71 template <
typename Matcher>
73 constexpr decltype(
auto) describe_impl(
74 const Matcher& matcher,
75 [[maybe_unused]]
const priority_tag<1>)
78 custom::matcher_traits<Matcher>{}.describe(matcher)
79 } -> std::convertible_to<StringViewT>;
82 return custom::matcher_traits<Matcher>{}.describe(matcher);
85 template <
typename Matcher>
87 constexpr decltype(
auto) describe_impl(
88 const Matcher& matcher,
89 [[maybe_unused]]
const priority_tag<0>)
90 requires requires { { matcher.describe() } -> std::convertible_to<StringViewT>; }
92 return matcher.describe();
95 constexpr priority_tag<1> maxTag;
97 constexpr auto describe = []<
typename Matcher>(
const Matcher& matcher) ->
decltype(
auto)
98 requires requires { { describe_impl(matcher, maxTag) } -> std::convertible_to<StringViewT>; }
100 return describe_impl(matcher, maxTag);
106 template <
typename T,
typename First,
typename... Others>
108 && std::is_move_constructible_v<T>
109 && std::destructible<T>
110 &&
requires(
const T& matcher, First& first, Others&... others) {
111 { detail::matches_hook::matches(matcher, first, others...) } -> std::convertible_to<bool>;
112 { detail::describe_hook::describe(matcher) } -> std::convertible_to<StringViewT>;
Definition Common.hpp:107
Definition BoostTest.hpp:20
Definition Utility.hpp:33