arg_router  1.4.0
C++ command line argument parsing and routing
arg_router::policy::error_name_t< S > Class Template Reference

#include <arg_router/policy/error_name.hpp>

Public Types

using string_type = S
 

Public Member Functions

constexpr error_name_t ([[maybe_unused]] S str={}) noexcept
 

Static Public Member Functions

constexpr static std::string_view error_name () noexcept
 

Detailed Description

template<typename S>
class arg_router::policy::error_name_t< S >

Represents the error name of an argument.

An error name is a label given to a node such that when it throws an error, this label is used to represent the node. This policy is typically not for use by users, it is for node developers to tune their node's representation in error output.

If using C++17 then use the template variable helper with the S_ macro; for C++20 and higher, use the constructor directly with a compile-time string literal:

constexpr auto a = ar::policy::error_name<S_("hello")>;
constexpr auto b = ar::policy::error_name_t{"hello"_S};
#define S_(tok)
Note
Error names must not be empty
Template Parameters
SCompile-time string

Definition at line 27 of file error_name.hpp.

Member Typedef Documentation

◆ string_type

template<typename S >
using arg_router::policy::error_name_t< S >::string_type = S

String type.

Definition at line 31 of file error_name.hpp.

Constructor & Destructor Documentation

◆ error_name_t()

template<typename S >
constexpr arg_router::policy::error_name_t< S >::error_name_t ( [[maybe_unused] ] S  str = {})
inlineexplicitconstexprnoexcept

Constructor.

Parameters
strString instance

Definition at line 37 of file error_name.hpp.

Member Function Documentation

◆ error_name()

template<typename S >
constexpr static std::string_view arg_router::policy::error_name_t< S >::error_name ( )
inlinestaticconstexprnoexcept

Returns the name.

Returns
Display name

Definition at line 43 of file error_name.hpp.


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