1 // Copyright (c) 2009-2016 Vladimir Batov.
2 // Use, modification and distribution are subject to the Boost Software License,
3 // Version 1.0. See http://www.boost.org/LICENSE_1_0.txt.
5 #ifndef BOOST_CONVERT_LEXICAL_CAST_HPP
6 #define BOOST_CONVERT_LEXICAL_CAST_HPP
8 #include <boost/lexical_cast.hpp>
10 namespace boost { namespace cnv
15 /// @brief boost::lexical_cast-based converter
16 /// @details The purpose of the converter is to
17 /// * Make use of the boost::lexical_cast functionality and performance that many people have become
18 /// accustomed to and comfortable with;
19 /// * Demonstrate how existing independent conversion/transformation-related facilities might be
20 // incorporated in to the Boost.Convert framework.
22 /// The converter can easily replace boost::lexical_cast, adding flexibility and convenience.
24 struct boost::cnv::lexical_cast
26 template<typename TypeOut, typename TypeIn>
28 operator()(TypeIn const& value_in, boost::optional<TypeOut>& result_out) const
32 result_out = boost::lexical_cast<TypeOut>(value_in);
34 catch (boost::bad_lexical_cast const&)
40 #endif // BOOST_CONVERT_LEXICAL_CAST_HPP