6 #ifndef SL_LOG_TUPLE_ALGORITHMS_HPP
7 #define SL_LOG_TUPLE_ALGORITHMS_HPP
14 namespace sl::log::detail
19 template <
class TTuple,
class... TArgs>
20 constexpr
bool operator ()(TTuple& tuple, TArgs&&... args)
const
22 return invoke<0>(tuple, std::forward<TArgs>(args)...);
26 template <std::size_t index,
class TTuple,
class... TArgs>
27 constexpr
bool invoke(TTuple& tuple, TArgs&&... args)
const
29 if constexpr (index < std::tuple_size_v<TTuple>)
31 if (!std::invoke(std::get<index>(tuple), std::forward<TArgs>(args)...))
35 return invoke<index + 1>(tuple, std::forward<TArgs>(args)...);
44 template <
class TTuple,
class... TArgs>
45 constexpr
bool operator ()(TTuple& tuple, TArgs&&... args)
const
47 return invoke<0>(tuple, std::forward<TArgs>(args)...);
51 template <std::size_t index,
class TTuple,
class... TArgs>
52 constexpr
bool invoke(TTuple& tuple, TArgs&&... args)
const
54 if constexpr (index < std::tuple_size_v<TTuple>)
56 if (std::invoke(std::get<index>(tuple), std::forward<TArgs>(args)...))
60 return invoke<index + 1>(tuple, std::forward<TArgs>(args)...);
69 using Super = TupleAnyOf;
72 template <
class TTuple,
class... TArgs>
73 constexpr
bool operator ()(TTuple& tuple, TArgs&&... args)
const
75 return !Super::operator()(tuple, std::forward<TArgs>(args)...);
82 template <
class TTuple,
class TFunc>
83 constexpr
void operator ()(TTuple& tuple, TFunc func)
const
85 invoke<0>(tuple, func);
89 template <std::
size_t index,
class TTuple,
class TFunc>
90 constexpr
void invoke(TTuple& tuple, TFunc func)
const
92 if constexpr (index < std::tuple_size_v<TTuple>)
94 std::invoke(func, std::get<index>(tuple));
95 invoke<index + 1>(tuple, func);