]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/math/include/boost/math/special_functions/detail/iconv.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / math / include / boost / math / special_functions / detail / iconv.hpp
CommitLineData
7c673cae
FG
1// Copyright (c) 2009 John Maddock
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_ICONV_HPP
7#define BOOST_MATH_ICONV_HPP
8
9#ifdef _MSC_VER
10#pragma once
11#endif
12
13#include <boost/math/special_functions/round.hpp>
14#include <boost/type_traits/is_convertible.hpp>
15
16namespace boost { namespace math { namespace detail{
17
18template <class T, class Policy>
19inline int iconv_imp(T v, Policy const&, mpl::true_ const&)
20{
21 return static_cast<int>(v);
22}
23
24template <class T, class Policy>
25inline int iconv_imp(T v, Policy const& pol, mpl::false_ const&)
26{
27 BOOST_MATH_STD_USING
28 return iround(v, pol);
29}
30
31template <class T, class Policy>
32inline int iconv(T v, Policy const& pol)
33{
34 typedef typename boost::is_convertible<T, int>::type tag_type;
35 return iconv_imp(v, pol, tag_type());
36}
37
38
39}}} // namespaces
40
41#endif // BOOST_MATH_ICONV_HPP
42