32 lines · plain
1// Copyright John Maddock 2006.2// Use, modification and distribution are subject to the3// Boost Software License, Version 1.0. (See accompanying file4// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)5 6#ifndef BOOST_MATH_TOOLS_REAL_CAST_HPP7#define BOOST_MATH_TOOLS_REAL_CAST_HPP8 9#include <boost/math/tools/config.hpp>10 11#ifdef _MSC_VER12#pragma once13#endif14 15namespace boost{ namespace math16{17 namespace tools18 {19 template <class To, class T>20 inline constexpr To real_cast(T t) noexcept(BOOST_MATH_IS_FLOAT(T) && BOOST_MATH_IS_FLOAT(To))21 {22 return static_cast<To>(t);23 }24 } // namespace tools25} // namespace math26} // namespace boost27 28#endif // BOOST_MATH_TOOLS_REAL_CAST_HPP29 30 31 32