kokkos-utils 0.0.1
 
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 template <typename... Args> requires (sizeof...(Args) == sizeof...(MatcherTypes))
19 explicit ConjunctionMatcher(Args&&... args) : matchers(std::forward<Args>(args)...) {}
20
21 template <Event EventType> requires (MatcherFor<MatcherTypes, EventType> && ...)
22 bool operator()(const EventType& event)
23 {
24 return std::apply([&event] (MatcherTypes&... matchers) {
25 return (matchers(event) && ...);
26 }, matchers);
27 }
28
29 std::tuple<MatcherTypes...> matchers;
30};
31
32template <typename... MatcherTypes>
33ConjunctionMatcher(MatcherTypes&&...) -> ConjunctionMatcher<MatcherTypes...>;
34
35} // namespace Kokkos::utils::callbacks
36
37#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.