Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:41:56

0001 
0002 #ifndef BOOST_MPL_NEGATE_HPP_INCLUDED
0003 #define BOOST_MPL_NEGATE_HPP_INCLUDED
0004 
0005 // Copyright Aleksey Gurtovoy 2000-2004
0006 //
0007 // Distributed under the Boost Software License, Version 1.0. 
0008 // (See accompanying file LICENSE_1_0.txt or copy at 
0009 // http://www.boost.org/LICENSE_1_0.txt)
0010 //
0011 // See http://www.boost.org/libs/mpl for documentation.
0012 
0013 // $Id$
0014 // $Date$
0015 // $Revision$
0016 
0017 #include <boost/mpl/integral_c.hpp>
0018 #include <boost/mpl/aux_/msvc_eti_base.hpp>
0019 #include <boost/mpl/aux_/na_spec.hpp>
0020 #include <boost/mpl/aux_/lambda_support.hpp>
0021 #include <boost/mpl/aux_/config/eti.hpp>
0022 #include <boost/mpl/aux_/config/integral.hpp>
0023 #include <boost/mpl/aux_/config/static_constant.hpp>
0024 
0025 namespace boost { namespace mpl {
0026 
0027 template< typename Tag > struct negate_impl;
0028 
0029 template< typename T > struct negate_tag
0030 {
0031     typedef typename T::tag type;
0032 };
0033 
0034 template<
0035       typename BOOST_MPL_AUX_NA_PARAM(N)
0036     >
0037 struct negate
0038 #if !defined(BOOST_MPL_CFG_MSVC_ETI_BUG)
0039     : negate_impl<
0040           typename negate_tag<N>::type
0041         >::template apply<N>::type
0042 #else
0043     : aux::msvc_eti_base< typename apply_wrap1<
0044           negate_impl< typename negate_tag<N>::type >
0045         , N
0046         >::type >::type
0047 #endif
0048 {
0049     BOOST_MPL_AUX_LAMBDA_SUPPORT(1, negate, (N))
0050 };
0051 
0052 BOOST_MPL_AUX_NA_SPEC(1, negate)
0053 
0054 
0055 #if defined(BOOST_MPL_CFG_NO_NESTED_VALUE_ARITHMETIC)
0056 namespace aux {
0057 template< typename T, T n > struct negate_wknd
0058 {
0059     BOOST_STATIC_CONSTANT(T, value = -n);
0060     typedef integral_c<T,value> type;
0061 };
0062 }
0063 #endif
0064 
0065 template<>
0066 struct negate_impl<integral_c_tag>
0067 {
0068 #if defined(BOOST_MPL_CFG_NO_NESTED_VALUE_ARITHMETIC)
0069     template< typename N > struct apply
0070         : aux::negate_wknd< typename N::value_type, N::value >
0071 #else
0072     template< typename N > struct apply
0073         : integral_c< typename N::value_type, (-N::value) >
0074 #endif    
0075     {
0076     };
0077 };
0078 
0079 }}
0080 
0081 #endif // BOOST_MPL_NEGATE_HPP_INCLUDED