cli20 0.1.2
A C++20 typed-schema command-line parser
Loading...
Searching...
No Matches
cli::validation::Predicate< Pred > Struct Template Reference

Validates a value using a user-supplied compile-time predicate. More...

#include <action.hh>

Public Types

template<class Prev>
using after_type = Prev
template<class Prev>
using storage_type = void

Public Member Functions

template<class U>
auto operator() (ActionCtx< void > ctx, ActionResult< U > input) const -> ActionResult< U >

Static Public Attributes

template<class Prev>
static constexpr bool accepts_input

Detailed Description

template<auto Pred>
struct cli::validation::Predicate< Pred >

Validates a value using a user-supplied compile-time predicate.

Pred must be a constexpr callable of the form (const T&) -> bool. Returns ErrorCode::validation_failed when Pred returns false.

Template Parameters
PredA constexpr callable acting as the validation predicate.

Definition at line 1419 of file action.hh.

Member Typedef Documentation

◆ after_type

template<auto Pred>
template<class Prev>
using cli::validation::Predicate< Pred >::after_type = Prev

Definition at line 1427 of file action.hh.

◆ storage_type

template<auto Pred>
template<class Prev>
using cli::validation::Predicate< Pred >::storage_type = void

Definition at line 1430 of file action.hh.

Member Function Documentation

◆ operator()()

template<auto Pred>
template<class U>
auto cli::validation::Predicate< Pred >::operator() ( ActionCtx< void > ctx,
ActionResult< U > input ) const -> ActionResult< U >
inline

Definition at line 1433 of file action.hh.

Member Data Documentation

◆ accepts_input

template<auto Pred>
template<class Prev>
bool cli::validation::Predicate< Pred >::accepts_input
staticconstexpr
Initial value:
=
requires(const detail::decay_t<Prev>& value) {
{ Pred(value) } -> std::convertible_to<bool>;
}

Definition at line 1421 of file action.hh.


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