|
||||
File indexing completed on 2025-01-18 09:30:27
0001 // Copyright (c) 2009-2020 Vladimir Batov. 0002 // Use, modification and distribution are subject to the Boost Software License, 0003 // Version 1.0. See http://www.boost.org/LICENSE_1_0.txt. 0004 0005 #ifndef BOOST_CONVERT_LEXICAL_CAST_HPP 0006 #define BOOST_CONVERT_LEXICAL_CAST_HPP 0007 0008 #include <boost/lexical_cast.hpp> 0009 0010 namespace boost { namespace cnv { struct lexical_cast; }} 0011 0012 /// @brief boost::lexical_cast-based converter 0013 /// @details The purpose of the converter is to 0014 /// * Make use of the boost::lexical_cast functionality and performance that many people have become 0015 /// accustomed to and comfortable with; 0016 /// * Demonstrate how existing independent conversion/transformation-related facilities might be 0017 // incorporated in to the Boost.Convert framework. 0018 /// 0019 /// The converter can easily replace boost::lexical_cast, adding flexibility and convenience. 0020 0021 struct boost::cnv::lexical_cast 0022 { 0023 template<typename TypeOut, typename TypeIn> 0024 void 0025 operator()(TypeIn const& value_in, boost::optional<TypeOut>& result_out) const 0026 { 0027 try 0028 { 0029 result_out = boost::lexical_cast<TypeOut>(value_in); 0030 } 0031 catch (boost::bad_lexical_cast const&) 0032 { 0033 } 0034 } 0035 }; 0036 0037 #endif // BOOST_CONVERT_LEXICAL_CAST_HPP
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |