Publishing R3
[platform/upstream/dldt.git] / inference-engine / thirdparty / clDNN / common / boost / 1.64.0 / include / boost-1_64 / boost / math / tools / convert_from_string.hpp
1 //  Copyright John Maddock 2016.
2 //  Use, modification and distribution are subject to the
3 //  Boost Software License, Version 1.0. (See accompanying file
4 //  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5
6 #ifndef BOOST_MATH_TOOLS_CONVERT_FROM_STRING_INCLUDED
7 #define BOOST_MATH_TOOLS_CONVERT_FROM_STRING_INCLUDED
8
9 #ifdef _MSC_VER
10 #pragma once
11 #endif
12
13 #include <boost/type_traits/is_constructible.hpp>
14 #include <boost/type_traits/conditional.hpp>
15 #include <boost/lexical_cast.hpp>
16
17 namespace boost{ namespace math{ namespace tools{
18
19    template <class T>
20    struct convert_from_string_result
21    {
22       typedef typename boost::conditional<boost::is_constructible<T, const char*>::value, const char*, T>::type type;
23    };
24
25    template <class Real>
26    Real convert_from_string(const char* p, const mpl::false_&)
27    {
28 #ifdef BOOST_MATH_NO_LEXICAL_CAST
29       // This function should not compile, we don't have the necesary functionality to support it:
30       BOOST_STATIC_ASSERT(sizeof(Real) == 0);
31 #else
32       return boost::lexical_cast<Real>(p);
33 #endif
34    }
35    template <class Real>
36    BOOST_CONSTEXPR const char* convert_from_string(const char* p, const mpl::true_&) BOOST_NOEXCEPT
37    {
38       return p;
39    }
40    template <class Real>
41    BOOST_CONSTEXPR typename convert_from_string_result<Real>::type convert_from_string(const char* p) BOOST_NOEXCEPT_IF((boost::is_constructible<Real, const char*>::value))
42    {
43       return convert_from_string<Real>(p, boost::is_constructible<Real, const char*>());
44    }
45
46 } // namespace tools
47 } // namespace math
48 } // namespace boost
49
50 #endif // BOOST_MATH_TOOLS_CONVERT_FROM_STRING_INCLUDED
51