File indexing completed on 2025-01-18 09:40:06
0001
0002
0003
0004
0005
0006 #ifndef BOOST_MATH_ICONV_HPP
0007 #define BOOST_MATH_ICONV_HPP
0008
0009 #ifdef _MSC_VER
0010 #pragma once
0011 #endif
0012
0013 #include <type_traits>
0014 #include <boost/math/special_functions/round.hpp>
0015
0016 namespace boost { namespace math { namespace detail{
0017
0018 template <class T, class Policy>
0019 inline int iconv_imp(T v, Policy const&, std::true_type const&)
0020 {
0021 return static_cast<int>(v);
0022 }
0023
0024 template <class T, class Policy>
0025 inline int iconv_imp(T v, Policy const& pol, std::false_type const&)
0026 {
0027 BOOST_MATH_STD_USING
0028 return iround(v, pol);
0029 }
0030
0031 template <class T, class Policy>
0032 inline int iconv(T v, Policy const& pol)
0033 {
0034 typedef typename std::is_convertible<T, int>::type tag_type;
0035 return iconv_imp(v, pol, tag_type());
0036 }
0037
0038
0039 }}}
0040
0041 #endif
0042