Boost.Convert C++ Reference
reference
this_type &TypeOut const &
TypeOutTypeIn const &
Converter const &
ConverterTypeOutvoidreference
this_type &TypeOut const &
TypeOut
TypeIn const &
Converter const &
reference< Converter, TypeOut, TypeIn >
Converter const &Boost.Convert deployment interface with algorithms. For example, boost::array<char const*, 3> strs = {{ " 5", "0XF", "not an int" }};
std::vector<int> ints;
boost::cnv::cstream cnv;
cnv(std::hex)(std::skipws);
std::transform(
strs.begin(),
strs.end(),
std::back_inserter(ints),
boost::cnv::apply<int>(boost::cref(cnv)).value_or(-1));
reference< Converter, TypeOut, void >
Converter const &
unspecifiedboost::throw_on_failure is the 'tag' object to request the exception-throwing behavior.
boost::optional< TypeOut >
TypeIn const &Value of the TypeIn type to be converted to the TypeOut type Converter const &Converter to be used for conversion Boost.Convert main deployment interface.
For example, boost::cnv::cstream cnv;
boost::optional<int> i = boost::convert<int>("12", cnv);
boost::optional<string> s = boost::convert<string>(123.456, cnv);
boost::optional<TypeOut> result of conversion together with the indication of success or failure of the conversion request.
boost::optional< TypeOut >
TypeIn const &Boost.Convert deployment interface with the default converter. For example, struct boost::cnv::by_default : boost::cnv::cstream {};
// boost::cnv::cstream (through boost::cnv::by_default) is deployed
// as the default converter when no converter is provided explicitly.
boost::optional<int> i = boost::convert<int>("12");
boost::optional<string> s = boost::convert<string>(123.456);
TypeOut
TypeIn const &Converter const &unspecifiedBoost.Convert non-optional deployment interface.
enable_if< is_convertible< Fallback, TypeOut >, TypeOut >::type
TypeIn const &Converter const &Fallback const &
enable_if< cnv::is_fun< Fallback, TypeOut >, TypeOut >::type
TypeIn const &Converter const &Fallback
cnvbase
int
unsigned int
long int
unsigned long int
short int
unsigned short int
long long int
unsigned long long int
float
double
long double
void
type_in const &boost::optional< type_out > &
int_typeoptional< string_type > &
uint_typeoptional< string_type > &
lint_typeoptional< string_type > &
llint_typeoptional< string_type > &
ulint_typeoptional< string_type > &
ullint_typeoptional< string_type > &
sint_typeoptional< string_type > &
usint_typeoptional< string_type > &
flt_typeoptional< string_type > &
dbl_typeoptional< string_type > &
ldbl_typeoptional< string_type > &
string_type const &optional< int_type > &
string_type const &optional< uint_type > &
string_type const &optional< lint_type > &
string_type const &optional< llint_type > &
string_type const &optional< ulint_type > &
string_type const &optional< ullint_type > &
string_type const &optional< sint_type > &
string_type const &optional< usint_type > &
string_type const &optional< flt_type > &
string_type const &optional< dbl_type > &
string_type const &optional< ldbl_type > &
basecnv::base
adjustcnv::adjust
precisionint
uppercasebool
skipwsbool
widthint
fillchar
void
string_type const &optional< out_type > &
void
in_typeoptional< string_type > &
derived_type const &
derived_type &
boost::lexical_cast-based converter The purpose of the converter is to
Make use of the boost::lexical_cast functionality and performance that many people have become accustomed to and comfortable with;
Demonstrate how existing independent conversion/transformation-related facilities might be The converter can easily replace boost::lexical_cast, adding flexibility and convenience.
void
TypeIn const &boost::optional< TypeOut > &
boost::cnv::cnvbase< boost::cnv::printf >boost::cnv::printf
boost::cnv::cnvbase< this_type >
cnv::range< char * >
in_typechar *
void
cnv::range< string_type >optional< out_type > &
int
char const *int
char const *int
boost::cnv::cnvbase< boost::cnv::spirit >boost::cnv::spirit
boost::cnv::cnvbase< this_type >
void
cnv::range< string_type >optional< out_type > &
cnv::range< char_type * >
in_typechar_type *
noncopyablebuffer_type
char_type const *std::size_t
buffer_typeChar
boost::cnv::basic_stream< char_type >
std::basic_stringstream< char_type >
std::basic_istream< char_type >
std::basic_streambuf< char_type >
std::basic_string< char_type >
std::ios_base &(*)(std::ios_base &)
type const &optional< string_type > &
string_type const &optional< type > &
void
char_type const *optional< type > &
void
stdstr_type const &optional< type > &
this_type &
manipulator
this_type &manipulator_type
this_type &std::locale const &
localestd::locale
precisionint
widthint
fillchar
uppercasebool
skipwsbool
adjustboost::cnv::adjust
baseboost::cnv::base
notationboost::cnv::notation
void
in_type const &boost::optional< string_type > &
void
boost::cnv::range< string_type >boost::optional< out_type > &
this_type &&
void
cnv::range< string_type >optional< out_type > &
void
in_type const &optional< string_type > &
boost::cnv::basic_stream< char >
boost::cnv::basic_stream< wchar_t >
boost::cnv::cnvbase< boost::cnv::strtol >std::strtol-based extended converter The converter offers a fairly decent overall performance and moderate formatting facilities. boost::cnv::strtol
boost::cnv::cnvbase< this_type >
void
cnv::range< string_type >optional< int_type > &
void
cnv::range< string_type >optional< sint_type > &
void
cnv::range< string_type >optional< lint_type > &
void
cnv::range< string_type >optional< llint_type > &
void
cnv::range< string_type >optional< uint_type > &
void
cnv::range< string_type >optional< usint_type > &
void
cnv::range< string_type >optional< ulint_type > &
void
cnv::range< string_type >optional< ullint_type > &
void
cnv::range< string_type >optional< flt_type > &
void
cnv::range< string_type >optional< dbl_type > &
void
cnv::range< string_type >optional< ldbl_type > &
cnv::range< char_type * >
int_typechar_type *
cnv::range< char_type * >
uint_typechar_type *
cnv::range< char_type * >
lint_typechar_type *
cnv::range< char_type * >
ulint_typechar_type *
cnv::range< char_type * >
llint_typechar_type *
cnv::range< char_type * >
ullint_typechar_type *
cnv::range< char_type * >
dbl_typechar_type *
cnv::range< char_type * >
in_typechar_type *
void
cnv::range< string_type >optional< out_type > &
void
cnv::range< string_type >optional< out_type > &
doubledoubleint
intint
boost::cnv::range< char_type * >
Typechar_type *
boost::cnv::range< char_type * >
doublechar_type *
void
cnv::range< string_type >boost::optional< out_type > &
T
A considerable number of libraries require an instance of a class provided (storage created and initialized). For example, Type result;
...
istream >> result;
In generic code that results in the Default Constructibility requirement imposed on every type 'Type' to be used with the respective code. Inevitably, that requirement a) either excludes all the classes that for various reasons do not meet that requirement or b) imposes certain (not necessarily desirable) design/implementation onto respective classes.Deployment of boost::make_default() eliminates the Default Constructibility requirement with Type result = boost::make_default<Type>();
...
istream >> result;
Classes with no default constructor can now be included via a boost::make_default() specialization: namespace boost
{
template<> inline Type make_default<Type>() { return Type(parameters); }
}