kokkos-utils 0.0.4
 
Loading...
Searching...
No Matches
ConjunctionMatcher.hpp
Go to the documentation of this file.
1#ifndef KOKKOS_UTILS_CALLBACKS_CONJUNCTIONMATCHER_HPP
2#define KOKKOS_UTILS_CALLBACKS_CONJUNCTIONMATCHER_HPP
3
6
8{
9
15template <Matcher... MatcherTypes> requires (sizeof...(MatcherTypes) > 1)
17{
18 ConjunctionMatcher() = default;
19
20 template <typename... Args> requires (sizeof...(Args) > 0 && sizeof...(Args) == sizeof...(MatcherTypes))
21 explicit ConjunctionMatcher(Args&&... args) : matchers(std::forward<Args>(args)...) {}
22
23 template <Event EventType> requires (MatcherFor<MatcherTypes, EventType> && ...)
24 bool operator()(const EventType& event)
25 {
26 return std::apply([&event] (MatcherTypes&... matchers_) {
27 return (matchers_(event) && ...);
28 }, matchers);
29 }
30
31 std::tuple<MatcherTypes...> matchers {};
32};
33
34template <typename... MatcherTypes>
35ConjunctionMatcher(MatcherTypes&&...) -> ConjunctionMatcher<MatcherTypes...>;
36
37} // namespace Kokkos::utils::callbacks
38
39#endif // KOKKOS_UTILS_CALLBACKS_CONJUNCTIONMATCHER_HPP
Check that Callable is a matcher for each event in EventTypes.
Definition Matcher.hpp:35
Callable is a matcher if it is invocable with at least one event type from Kokkos::utils::callbacks::...
Definition Matcher.hpp:31
ConjunctionMatcher(MatcherTypes &&...) -> ConjunctionMatcher< MatcherTypes... >
Conjunction of matchers that is true only if all matchers agree.