Public Member Functions | List of all members
beluga::policy< PolicyFn > Struct Template Reference

Forward declaration of policy. More...

#include <policy.hpp>

Public Member Functions

template<class... Args>
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. More...
 
 policy ()=default
 Default constructor. More...
 
constexpr policy (PolicyFn fn)
 Conversion constructor. More...
 

Detailed Description

template<class PolicyFn>
struct beluga::policy< 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:

  1. Both policies can be evaluated with the same arguments.
  2. 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.

Definition at line 24 of file policy.hpp.

Constructor & Destructor Documentation

◆ policy() [1/2]

template<class PolicyFn >
beluga::policy< PolicyFn >::policy ( )
default

Default constructor.

◆ policy() [2/2]

template<class PolicyFn >
constexpr beluga::policy< PolicyFn >::policy ( PolicyFn  fn)
inlineexplicitconstexpr

Conversion constructor.

Definition at line 107 of file policy.hpp.

Member Function Documentation

◆ operator()()

template<class PolicyFn >
template<class... Args>
constexpr auto beluga::policy< PolicyFn >::operator() ( Args...  ) -> std::enable_if_t< std::is_invocable_r_v<bool, PolicyFn> && !std::is_invocable_r_v<bool, PolicyFn, Args...>, bool>
inlineconstexpr

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.

Definition at line 119 of file policy.hpp.


The documentation for this struct was generated from the following file:


beluga
Author(s):
autogenerated on Tue Jul 16 2024 02:59:54