| 1 | // Copyright John Maddock 2006. |
| 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_REAL_CAST_HPP |
| 7 | #define BOOST_MATH_TOOLS_REAL_CAST_HPP |
| 8 | |
| 9 | #include <boost/math/tools/config.hpp> |
| 10 | |
| 11 | #ifdef _MSC_VER |
| 12 | #pragma once |
| 13 | #endif |
| 14 | |
| 15 | namespace boost{ namespace math |
| 16 | { |
| 17 | namespace tools |
| 18 | { |
| 19 | template <class To, class T> |
| 20 | inline BOOST_MATH_CONSTEXPR To real_cast(T t) BOOST_NOEXCEPT_IF(BOOST_MATH_IS_FLOAT(T) && BOOST_MATH_IS_FLOAT(To)) |
| 21 | { |
| 22 | return static_cast<To>(t); |
| 23 | } |
| 24 | } // namespace tools |
| 25 | } // namespace math |
| 26 | } // namespace boost |
| 27 | |
| 28 | #endif // BOOST_MATH_TOOLS_REAL_CAST_HPP |
| 29 | |
| 30 | |
| 31 | |
| 32 | |