annotate DEPENDENCIES/generic/include/boost/ratio/detail/mpl/abs.hpp @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents c530137014c0
children
rev   line source
Chris@16 1 ////////////////////////////////////////////////////////////////////
Chris@16 2 //
Chris@16 3 // Copyright Vicente J. Botet Escriba 2010
Chris@16 4 //
Chris@101 5 // Distributed under the Boost Software License, Version 1.0.
Chris@101 6 // (See accompanying file LICENSE_1_0.txt or copy at
Chris@16 7 // http://www.boost.org/LICENSE_1_0.txt)
Chris@16 8 //
Chris@16 9 // See http://www.boost.org/libs/mpl for documentation.
Chris@16 10 //
Chris@16 11 ////////////////////////////////////////////////////////////////////
Chris@16 12 #ifndef BOOST_MPL_ABS_HPP_INCLUDED
Chris@16 13 #define BOOST_MPL_ABS_HPP_INCLUDED
Chris@16 14
Chris@16 15 #include <boost/mpl/integral_c.hpp>
Chris@16 16 #include <boost/mpl/aux_/na_spec.hpp>
Chris@16 17 #include <boost/mpl/aux_/lambda_support.hpp>
Chris@16 18 #include <boost/mpl/aux_/config/integral.hpp>
Chris@16 19 #include <boost/mpl/aux_/config/static_constant.hpp>
Chris@16 20
Chris@16 21 #if !defined(BOOST_MPL_CFG_NO_NESTED_VALUE_ARITHMETIC_2) \
Chris@16 22 && !defined(BOOST_MPL_PREPROCESSING_MODE) \
Chris@101 23 && !defined(__CUDACC__) \
Chris@16 24 && ( defined(BOOST_MSVC) \
Chris@16 25 || BOOST_WORKAROUND(__EDG_VERSION__, <= 238) \
Chris@16 26 )
Chris@16 27
Chris@16 28 # define BOOST_MPL_CFG_NO_NESTED_VALUE_ARITHMETIC_2
Chris@16 29
Chris@16 30 #endif
Chris@16 31
Chris@16 32 namespace boost { namespace mpl {
Chris@16 33
Chris@16 34 template< typename Tag > struct abs_impl;
Chris@16 35
Chris@16 36 template< typename T > struct abs_tag
Chris@16 37 {
Chris@16 38 typedef typename T::tag type;
Chris@16 39 };
Chris@16 40
Chris@16 41 template<
Chris@16 42 typename BOOST_MPL_AUX_NA_PARAM(N)
Chris@16 43 >
Chris@16 44 struct abs
Chris@16 45 : abs_impl<
Chris@16 46 typename abs_tag<N>::type
Chris@16 47 >::template apply<N>::type
Chris@16 48 {
Chris@16 49 BOOST_MPL_AUX_LAMBDA_SUPPORT(1, abs, (N))
Chris@16 50 };
Chris@16 51
Chris@16 52 BOOST_MPL_AUX_NA_SPEC(1, abs)
Chris@16 53
Chris@16 54 template<
Chris@16 55 typename T
Chris@16 56 , T n1
Chris@16 57 >
Chris@16 58 struct abs_c
Chris@16 59 : abs<integral_c<T,n1> >
Chris@16 60 {
Chris@16 61 };
Chris@16 62
Chris@16 63 #if defined(BOOST_MPL_CFG_NO_NESTED_VALUE_ARITHMETIC_2)
Chris@16 64 namespace aux {
Chris@16 65 template< typename T, T n > struct abs_wknd
Chris@16 66 {
Chris@16 67 BOOST_STATIC_CONSTANT(T, value = (n < 0 ? -n : n));
Chris@16 68 typedef integral_c<T,value> type;
Chris@16 69 };
Chris@16 70 }
Chris@16 71 #endif
Chris@16 72
Chris@16 73 template<>
Chris@16 74 struct abs_impl<integral_c_tag>
Chris@16 75 {
Chris@16 76 #if defined(BOOST_MPL_CFG_NO_NESTED_VALUE_ARITHMETIC_2)
Chris@16 77 template< typename N > struct apply
Chris@16 78 : aux::abs_wknd< typename N::value_type, N::value >
Chris@16 79 #else
Chris@16 80 template< typename N > struct apply
Chris@16 81 : integral_c< typename N::value_type, ((N::value < 0) ? (-N::value) : N::value ) >
Chris@101 82 #endif
Chris@16 83 {
Chris@16 84 };
Chris@16 85 };
Chris@16 86
Chris@16 87 }}
Chris@16 88
Chris@16 89 #endif // BOOST_MPL_ABS_HPP_INCLUDED