diff --git a/doc/lexical_cast.qbk b/doc/lexical_cast.qbk index dd7673b..ad9b5f2 100644 --- a/doc/lexical_cast.qbk +++ b/doc/lexical_cast.qbk @@ -72,7 +72,7 @@ Library features defined in [@boost:boost/lexical_cast.hpp boost/lexical_cast.hp namespace conversion { template - bool try_lexical_convert(Source&& arg, Target& result); + bool try_lexical_convert(const Source& arg, Target& result); template bool try_lexical_convert(const AnyCharacterType* chars, std::size_t count, Target& result); @@ -134,11 +134,11 @@ Exception used to indicate runtime lexical_cast failure. [section try_lexical_convert] `boost::lexical_cast` remains the main interface for lexical conversions. It must be used by default in most cases. However -some developers wish to make their own conversion functions, reusing all the optimizations of `boost::lexical_cast`. That's -where the `boost::conversion::try_lexical_convert` function steps in. +some developers wish to make their own conversion functions, reusing all the optimizations of the `boost::lexical_cast`. +That's where the `boost::conversion::try_lexical_convert` function steps in. -`try_lexical_convert` returns `true` if conversion succeeded, otherwise returns `false`. If conversion failed and `false` was returned, -state of `result` output variable is undefined. +`try_lexical_convert` returns `true` if conversion succeeded, otherwise returns `false`. If conversion +failed and `false` was returned, state of `result` output variable is undefined. Actually, `boost::lexical_cast` is implemented using `try_lexical_convert`: `` @@ -154,8 +154,7 @@ Actually, `boost::lexical_cast` is implemented using `try_lexical_convert`: } `` -`try_lexical_convert` relaxes the requirements for `Target` type. `Target` must not be CopyConstructible or DefaultConstructible. - +`try_lexical_convert` relaxes the CopyConstructible and DefaultConstructible requirements for `Target` type. Following requirements for `Target` and `Source` remain: * Source must be OutputStreamable, meaning that an `operator<<` is defined that takes a `std::ostream` or `std::wostream` object on the left hand side and an instance of the argument type on the right. diff --git a/include/boost/lexical_cast.hpp b/include/boost/lexical_cast.hpp index ae47053..421b823 100644 --- a/include/boost/lexical_cast.hpp +++ b/include/boost/lexical_cast.hpp @@ -2077,9 +2077,6 @@ namespace boost { i_interpreter_type i_interpreter; // Disabling ADL, by directly specifying operators. - // - // For compilers with perfect forwarding `static_cast(arg)` is - // eqaul to `std::forward(arg)`. if (!(i_interpreter.operator <<(arg))) return false; @@ -2252,25 +2249,10 @@ namespace boost { namespace conversion { namespace detail { -// MSVC fail to forward an array (DevDiv#555157 "SILENT BAD CODEGEN triggered by perfect forwarding", -// fixed in 2013 RTM). -#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && (!defined(BOOST_MSVC) || BOOST_MSVC >= 1800) - template - inline bool try_lexical_convert(Source&& arg, Target& result) - { - typedef BOOST_DEDUCED_TYPENAME boost::remove_const< - BOOST_DEDUCED_TYPENAME boost::remove_reference::type - >::type no_cr_source_t; - - typedef Source&& forward_type; -#else template inline bool try_lexical_convert(const Source& arg, Target& result) { - typedef Source no_cr_source_t; - typedef const Source& forward_type; -#endif - typedef BOOST_DEDUCED_TYPENAME boost::detail::array_to_pointer_decay::type src; + typedef BOOST_DEDUCED_TYPENAME boost::detail::array_to_pointer_decay::type src; typedef BOOST_DEDUCED_TYPENAME boost::type_traits::ice_or< boost::detail::is_xchar_to_xchar::value, @@ -2302,7 +2284,7 @@ namespace boost { typedef BOOST_DEDUCED_TYPENAME caster_type_lazy::type caster_type; - return caster_type::try_convert(static_cast(arg), result); + return caster_type::try_convert(arg, result); } template