All Classes Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
gears::optparse::store< T > Struct Template Reference

The default action used for values. More...

Public Member Functions

operator() (const std::string &, const std::string &value) const
 The operator doing the conversion. More...
 

Detailed Description

template<typename T>
struct gears::optparse::store< T >

The default action used for typed_value. It parses a single string argument to the appropriate type provided.

Template Parameters
TThe type to convert the value to.

Definition at line 68 of file actions.hpp.

Member Function Documentation

template<typename T >
T gears::optparse::store< T >::operator() ( const std::string &  ,
const std::string &  value 
) const
inline

The operator doing the conversion from string to the specified type. A specialisation is provided for bool types that parses "1" and "true" as true and "0" and "false" as false.

Exceptions
std::runtime_errorIf boolean conversion failed.
std::bad_castIf other conversions failed.
Parameters
keyThe key of the command line option.
valueThe value of the command line option.
Returns
The equivalent of doing gears::string::lexical_cast<T>(value).

Definition at line 82 of file actions.hpp.