Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

PrevUpHomeNext

Struct lexical_cast

boost::cnv::lexical_cast — boost::lexical_cast-based converter

Synopsis

// In header: <boost/convert/lexical_cast.hpp>


struct lexical_cast {

  // public member functions
  template<typename TypeOut, typename TypeIn> 
    void operator()(TypeIn const &, boost::optional< TypeOut > &) const;
};

Description

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.

lexical_cast public member functions

  1. template<typename TypeOut, typename TypeIn> 
      void operator()(TypeIn const & value_in, 
                      boost::optional< TypeOut > & result_out) const;

PrevUpHomeNext