MCPcopy Create free account
hub / github.com/boost-ext/ut / any_of

Class any_of

example/matcher.cpp:29–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27
28template <class... Ts>
29class any_of {
30 public:
31 constexpr explicit any_of(Ts... ts) : ts_{ts...} {}
32
33 constexpr auto operator==(std::common_type_t<Ts...> t) const {
34 return std::apply([t](auto... args) { return eq(t, args...); }, ts_);
35 }
36
37 private:
38 template <class T, class U, class... TArgs>
39 static constexpr auto eq(const T& t, const U& u, const TArgs&... args) {
40 using namespace boost::ut;
41 if constexpr (sizeof...(args) > 0) {
42 return (that % detail::value{u} == t) or eq(t, args...);
43 } else {
44 return (that % detail::value{u} == t);
45 }
46 }
47
48 std::tuple<Ts...> ts_;
49};
50
51int main() {
52 using namespace boost::ut;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected