]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/ratio/include/boost/ratio/detail/mpl/sign.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / ratio / include / boost / ratio / detail / mpl / sign.hpp
CommitLineData
7c673cae
FG
1////////////////////////////////////////////////////////////////////
2//
3// Copyright Vicente J. Botet Escriba 2010
4//
5// Distributed under the Boost Software License, Version 1.0.
6// (See accompanying file LICENSE_1_0.txt or copy at
7// http://www.boost.org/LICENSE_1_0.txt)
8//
9// See http://www.boost.org/libs/mpl for documentation.
10//
11////////////////////////////////////////////////////////////////////
12#ifndef BOOST_MPL_SIGN_HPP_INCLUDED
13#define BOOST_MPL_SIGN_HPP_INCLUDED
14
15#include <boost/mpl/integral_c.hpp>
16#include <boost/mpl/aux_/na_spec.hpp>
17#include <boost/mpl/aux_/lambda_support.hpp>
18#include <boost/mpl/aux_/config/integral.hpp>
19#include <boost/mpl/aux_/config/static_constant.hpp>
20
21#if !defined(BOOST_MPL_CFG_NO_NESTED_VALUE_ARITHMETIC_2) \
22 && !defined(BOOST_MPL_PREPROCESSING_MODE) \
23 && !defined(__CUDACC__) \
24 && ( defined(BOOST_MSVC) \
25 || BOOST_WORKAROUND(__EDG_VERSION__, <= 238) \
26 )
27
28# define BOOST_MPL_CFG_NO_NESTED_VALUE_ARITHMETIC_2
29
30#endif
31
32namespace boost { namespace mpl {
33
34template< typename Tag > struct sign_impl;
35
36template< typename T > struct sign_tag
37{
38 typedef typename T::tag type;
39};
40
41template<
42 typename BOOST_MPL_AUX_NA_PARAM(N)
43 >
44struct sign
45 : sign_impl<
46 typename sign_tag<N>::type
47 >::template apply<N>::type
48{
49 BOOST_MPL_AUX_LAMBDA_SUPPORT(1, sign, (N))
50};
51
52BOOST_MPL_AUX_NA_SPEC(1, sign)
53
54template<
55 typename T
56 , T n1
57 >
58struct sign_c
59 : sign<integral_c<T,n1> >
60{
61};
62
63#if defined(BOOST_MPL_CFG_NO_NESTED_VALUE_ARITHMETIC_2)
64namespace aux {
65template< typename T, T n > struct sign_wknd
66{
67 BOOST_STATIC_CONSTANT(T, value = (n == 0 ? 0 : (n < 0 ? -1 : 1)));
68 typedef integral_c<T,value> type;
69};
70}
71#endif
72
73template<>
74struct sign_impl<integral_c_tag>
75{
76#if defined(BOOST_MPL_CFG_NO_NESTED_VALUE_ARITHMETIC_2)
77 template< typename N > struct apply
78 : aux::sign_wknd< typename N::value_type, N::value >
79#else
80 template< typename N > struct apply
81 : integral_c< typename N::value_type, (N::value == 0 ? 0 : (N::value < 0 ? -1 : 1)) >
82#endif
83 {
84 };
85};
86
87}}
88
89#endif // BOOST_MPL_SIGN_HPP_INCLUDED