// Copyright John Maddock 2016. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_MATH_TOOLS_CONVERT_FROM_STRING_INCLUDED #define BOOST_MATH_TOOLS_CONVERT_FROM_STRING_INCLUDED #ifdef _MSC_VER #pragma once #endif #include #include #include namespace boost{ namespace math{ namespace tools{ template struct convert_from_string_result { typedef typename boost::conditional::value, const char*, T>::type type; }; template Real convert_from_string(const char* p, const std::false_type&) { #ifdef BOOST_MATH_NO_LEXICAL_CAST // This function should not compile, we don't have the necessary functionality to support it: BOOST_STATIC_ASSERT(sizeof(Real) == 0); #else return boost::lexical_cast(p); #endif } template BOOST_CONSTEXPR const char* convert_from_string(const char* p, const std::true_type&) BOOST_NOEXCEPT { return p; } template BOOST_CONSTEXPR typename convert_from_string_result::type convert_from_string(const char* p) BOOST_NOEXCEPT_IF((std::is_constructible::value)) { return convert_from_string(p, std::is_constructible()); } } // namespace tools } // namespace math } // namespace boost #endif // BOOST_MATH_TOOLS_CONVERT_FROM_STRING_INCLUDED