Loading [MathJax]/extensions/tex2jax.js
raberu v1.1.0
Fancy Named Parameter Library
 
All Classes Namespaces Functions Typedefs Friends Modules Pages Concepts
Loading...
Searching...
No Matches

◆ accept()

static constexpr bool rbr::as_keyword< typed_keyword< ID, Type > >::accept ( )
inlinestaticconstexprinherited

Compile-time validation of value.

When a value is bound to a Keyword to form an Option, one can validate this binding by checking arbitrary properties on the value type. This is done by the accept() member.

If Keyword defines a check static template member function, it will be called to provide the return value of accept(). Otherwise, true is returned, thus automatically validating any value type.

Template Parameters
TType to validate
Returns
true if T is accepted by current keyword, false otherwise.

Example:

#include <raberu/raberu.hpp>
// Defines a keyword type that only accept floating point value
struct real_keyword : rbr::as_keyword<real_keyword>
{
template<typename T> static constexpr bool check() { return std::is_floating_point_v<T>; }
};
inline constexpr real_keyword real = {};
constexpr any_keyword< ID > keyword(ID id) noexcept
Create a regular keyword for reuse.
Definition keywords.hpp:340
constexpr typed_keyword< ID, Type > keyword(ID id) noexcept
Create a typed Keyword for reuse.
Definition keywords.hpp:366
Base class for keyword definition.
Definition keywords.hpp:62