epoc32/include/stdapis/boost/mpl/negate.hpp
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:27:01 +0100
branchSymbian2
changeset 3 e1b950c65cb4
permissions -rw-r--r--
Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
williamr@2
     1
williamr@2
     2
#ifndef BOOST_MPL_NEGATE_HPP_INCLUDED
williamr@2
     3
#define BOOST_MPL_NEGATE_HPP_INCLUDED
williamr@2
     4
williamr@2
     5
// Copyright Aleksey Gurtovoy 2000-2004
williamr@2
     6
//
williamr@2
     7
// Distributed under the Boost Software License, Version 1.0. 
williamr@2
     8
// (See accompanying file LICENSE_1_0.txt or copy at 
williamr@2
     9
// http://www.boost.org/LICENSE_1_0.txt)
williamr@2
    10
//
williamr@2
    11
// See http://www.boost.org/libs/mpl for documentation.
williamr@2
    12
williamr@2
    13
// $Source: /cvsroot/boost/boost/boost/mpl/negate.hpp,v $
williamr@2
    14
// $Date: 2004/09/07 09:06:08 $
williamr@2
    15
// $Revision: 1.4 $
williamr@2
    16
williamr@2
    17
#include <boost/mpl/integral_c.hpp>
williamr@2
    18
#include <boost/mpl/aux_/msvc_eti_base.hpp>
williamr@2
    19
#include <boost/mpl/aux_/na_spec.hpp>
williamr@2
    20
#include <boost/mpl/aux_/lambda_support.hpp>
williamr@2
    21
#include <boost/mpl/aux_/config/eti.hpp>
williamr@2
    22
#include <boost/mpl/aux_/config/integral.hpp>
williamr@2
    23
#include <boost/mpl/aux_/config/static_constant.hpp>
williamr@2
    24
williamr@2
    25
namespace boost { namespace mpl {
williamr@2
    26
williamr@2
    27
template< typename Tag > struct negate_impl;
williamr@2
    28
williamr@2
    29
template< typename T > struct negate_tag
williamr@2
    30
{
williamr@2
    31
    typedef typename T::tag type;
williamr@2
    32
};
williamr@2
    33
williamr@2
    34
template<
williamr@2
    35
      typename BOOST_MPL_AUX_NA_PARAM(N)
williamr@2
    36
    >
williamr@2
    37
struct negate
williamr@2
    38
#if !defined(BOOST_MPL_CFG_MSVC_ETI_BUG)
williamr@2
    39
    : negate_impl<
williamr@2
    40
          typename negate_tag<N>::type
williamr@2
    41
        >::template apply<N>::type
williamr@2
    42
#else
williamr@2
    43
    : aux::msvc_eti_base< typename apply_wrap1<
williamr@2
    44
          negate_impl< typename negate_tag<N>::type >
williamr@2
    45
        , N
williamr@2
    46
        >::type >::type
williamr@2
    47
#endif
williamr@2
    48
{
williamr@2
    49
    BOOST_MPL_AUX_LAMBDA_SUPPORT(1, negate, (N))
williamr@2
    50
};
williamr@2
    51
williamr@2
    52
BOOST_MPL_AUX_NA_SPEC(1, negate)
williamr@2
    53
williamr@2
    54
williamr@2
    55
#if defined(BOOST_MPL_CFG_NO_NESTED_VALUE_ARITHMETIC)
williamr@2
    56
namespace aux {
williamr@2
    57
template< typename T, T n > struct negate_wknd
williamr@2
    58
{
williamr@2
    59
    BOOST_STATIC_CONSTANT(T, value = -n);
williamr@2
    60
    typedef integral_c<T,value> type;
williamr@2
    61
};
williamr@2
    62
}
williamr@2
    63
#endif
williamr@2
    64
williamr@2
    65
template<>
williamr@2
    66
struct negate_impl<integral_c_tag>
williamr@2
    67
{
williamr@2
    68
#if defined(BOOST_MPL_CFG_NO_NESTED_VALUE_ARITHMETIC)
williamr@2
    69
    template< typename N > struct apply
williamr@2
    70
        : aux::negate_wknd< typename N::value_type, N::value >
williamr@2
    71
#else
williamr@2
    72
    template< typename N > struct apply
williamr@2
    73
        : integral_c< typename N::value_type, (-N::value) >
williamr@2
    74
#endif    
williamr@2
    75
    {
williamr@2
    76
    };
williamr@2
    77
};
williamr@2
    78
williamr@2
    79
}}
williamr@2
    80
williamr@2
    81
#endif // BOOST_MPL_NEGATE_HPP_INCLUDED