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

Converts a string token to a floating-point type T using std::from_chars. More...

#include <action.hh>

Public Types

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

Public Member Functions

constexpr auto operator() (ActionCtx< void > ctx, ActionResult< std::string_view > input) const -> ActionResult< T >

Static Public Attributes

template<class Input>
static constexpr bool accepts_input

Detailed Description

template<std::floating_point T>
struct cli::conversion::Floating< T >

Converts a string token to a floating-point type T using std::from_chars.

Returns ErrorCode::invalid_value for non-numeric or partially-consumed input, and ErrorCode::out_of_range on overflow.

Template Parameters
TThe target floating-point type (e.g. float, double).

Definition at line 699 of file action.hh.

Member Typedef Documentation

◆ after_type

template<std::floating_point T>
template<class Input>
using cli::conversion::Floating< T >::after_type = T

Definition at line 706 of file action.hh.

◆ storage_type

template<std::floating_point T>
template<class Prev>
using cli::conversion::Floating< T >::storage_type = void

Definition at line 709 of file action.hh.

Member Function Documentation

◆ operator()()

template<std::floating_point T>
auto cli::conversion::Floating< T >::operator() ( ActionCtx< void > ctx,
ActionResult< std::string_view > input ) const -> ActionResult< T >
inlineconstexpr

Definition at line 711 of file action.hh.

Member Data Documentation

◆ accepts_input

template<std::floating_point T>
template<class Input>
bool cli::conversion::Floating< T >::accepts_input
staticconstexpr
Initial value:
=
std::same_as<std::remove_cvref_t<Input>, std::string_view> ||
std::same_as<std::remove_cvref_t<Input>, std::string>

Definition at line 701 of file action.hh.


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