Template Struct policy
Defined in File policy.hpp
Inheritance Relationships
Base Types
public beluga::policy_base
(Struct policy_base)public PolicyFn
Struct Documentation
-
template<class PolicyFn>
struct policy : public beluga::policy_base, public PolicyFn Forward declaration of policy.
Policy template class.
A policy is a declarative lazily-evaluated possibly stateful predicate that can be composed with other predicates using overloaded boolean operators.
Two policies can be composed if any of the following conditions is satisfied:
Both policies can be evaluated with the same arguments.
Either of the policies can be evaluated with no arguments.
If the second condition applies, the resulting policy will have to be called with the arguments of the one that does take arguments.
A policy should be cheaply copyable and its arguments will always be passed by const-reference.
Public Functions
-
policy() = default
Default constructor.
-
template<class ...Args>
inline constexpr auto operator()(Args...) -> std::enable_if_t<std::is_invocable_r_v<bool, PolicyFn> && !std::is_invocable_r_v<bool, PolicyFn, Args...>, bool> Call operator overload.
If the function object can be called with no arguments, enable this overload that takes any amount of arguments so it can be composed with any other policy.