source: XIOS/dev/dev_olga/src/extern/boost/include/boost/type_traits/floating_point_promotion.hpp @ 1022

Last change on this file since 1022 was 1022, checked in by mhnguyen, 7 years ago
File size: 2.0 KB
Line 
1// Copyright 2005 Alexander Nasonov.
2// Distributed under the Boost Software License, Version 1.0. (See
3// accompanying file LICENSE_1_0.txt or copy at
4// http://www.boost.org/LICENSE_1_0.txt)
5
6#ifndef FILE_boost_type_traits_floating_point_promotion_hpp_INCLUDED
7#define FILE_boost_type_traits_floating_point_promotion_hpp_INCLUDED
8
9#include <boost/config.hpp>
10
11#ifdef BOOST_NO_CV_SPECIALIZATIONS
12#include <boost/mpl/at.hpp>
13#include <boost/mpl/int.hpp>
14#include <boost/mpl/multiplies.hpp>
15#include <boost/mpl/plus.hpp>
16#include <boost/mpl/vector.hpp>
17#include <boost/type_traits/is_same.hpp>
18#endif
19
20// Should be the last #include
21#include <boost/type_traits/detail/type_trait_def.hpp>
22
23namespace boost {
24
25namespace type_traits { namespace detail {
26
27#ifndef BOOST_NO_CV_SPECIALIZATIONS
28
29template<class T>
30struct floating_point_promotion
31{
32    typedef T type;
33};
34
35template<>
36struct floating_point_promotion<float>
37{
38    typedef double type;
39};
40
41template<>
42struct floating_point_promotion<float const>
43{
44    typedef double const type;
45};
46
47template<>
48struct floating_point_promotion<float volatile>
49{
50    typedef double volatile type;
51};
52
53template<>
54struct floating_point_promotion<float const volatile>
55{
56    typedef double const volatile type;
57};
58
59#else
60
61template<class T>
62struct floating_point_promotion
63  : mpl::at<
64        mpl::vector< T, double, double const, double volatile,
65                     double const volatile >
66      , mpl::plus<
67            is_same<T, float>
68          , mpl::multiplies< is_same<T, float const>         , mpl::int_<2> >
69          , mpl::multiplies< is_same<T, float volatile>      , mpl::int_<3> >
70          , mpl::multiplies< is_same<T, float const volatile>, mpl::int_<4> >
71          >
72      >
73{
74};
75
76#endif
77
78} }
79
80BOOST_TT_AUX_TYPE_TRAIT_DEF1(
81      floating_point_promotion
82    , T
83    , BOOST_DEDUCED_TYPENAME
84        boost::type_traits::detail::floating_point_promotion<T>::type
85    )
86}
87
88#include <boost/type_traits/detail/type_trait_undef.hpp>
89
90#endif // #ifndef FILE_boost_type_traits_floating_point_promotion_hpp_INCLUDED
91
Note: See TracBrowser for help on using the repository browser.