imgtools/imglib/boostlibrary/boost/mpl/if.hpp
author Mike Kinghan <mikek@symbian.org>
Tue, 13 Jul 2010 15:21:54 +0100
changeset 24 936784880b21
parent 2 39c28ec933dd
permissions -rwxr-xr-x
Seems I can't "unforget" erroneously forgotten files, so will have to forget them and then re-add them
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
     1
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
     2
#ifndef BOOST_MPL_IF_HPP_INCLUDED
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
     3
#define BOOST_MPL_IF_HPP_INCLUDED
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
     4
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
     5
// Copyright Aleksey Gurtovoy 2000-2004
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
     6
//
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
     7
// Distributed under the Boost Software License, Version 1.0. 
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
     8
// (See accompanying file LICENSE_1_0.txt or copy at 
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
     9
// http://www.boost.org/LICENSE_1_0.txt)
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    10
//
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    11
// See http://www.boost.org/libs/mpl for documentation.
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    12
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    13
// $Id: if.hpp 49267 2008-10-11 06:19:02Z agurtovoy $
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    14
// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    15
// $Revision: 49267 $
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    16
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    17
#include <boost/mpl/aux_/value_wknd.hpp>
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    18
#include <boost/mpl/aux_/static_cast.hpp>
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    19
#include <boost/mpl/aux_/na_spec.hpp>
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    20
#include <boost/mpl/aux_/lambda_support.hpp>
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    21
#include <boost/mpl/aux_/config/integral.hpp>
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    22
#include <boost/mpl/aux_/config/ctps.hpp>
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    23
#include <boost/mpl/aux_/config/workaround.hpp>
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    24
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    25
namespace boost { namespace mpl {
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    26
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    27
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    28
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    29
template<
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    30
      bool C
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    31
    , typename T1
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    32
    , typename T2
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    33
    >
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    34
struct if_c
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    35
{
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    36
    typedef T1 type;
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    37
};
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    38
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    39
template<
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    40
      typename T1
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    41
    , typename T2
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    42
    >
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    43
struct if_c<false,T1,T2>
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    44
{
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    45
    typedef T2 type;
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    46
};
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    47
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    48
// agurt, 05/sep/04: nondescriptive parameter names for the sake of DigitalMars
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    49
// (and possibly MWCW < 8.0); see http://article.gmane.org/gmane.comp.lib.boost.devel/108959
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    50
template<
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    51
      typename BOOST_MPL_AUX_NA_PARAM(T1)
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    52
    , typename BOOST_MPL_AUX_NA_PARAM(T2)
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    53
    , typename BOOST_MPL_AUX_NA_PARAM(T3)
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    54
    >
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    55
struct if_
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    56
{
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    57
 private:
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    58
    // agurt, 02/jan/03: two-step 'type' definition for the sake of aCC 
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    59
    typedef if_c<
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    60
#if defined(BOOST_MPL_CFG_BCC_INTEGRAL_CONSTANTS)
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    61
          BOOST_MPL_AUX_VALUE_WKND(T1)::value
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    62
#else
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    63
          BOOST_MPL_AUX_STATIC_CAST(bool, BOOST_MPL_AUX_VALUE_WKND(T1)::value)
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    64
#endif
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    65
        , T2
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    66
        , T3
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    67
        > almost_type_;
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    68
 
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    69
 public:
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    70
    typedef typename almost_type_::type type;
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    71
    
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    72
    BOOST_MPL_AUX_LAMBDA_SUPPORT(3,if_,(T1,T2,T3))
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    73
};
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    74
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    75
#else
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    76
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    77
// no partial class template specialization
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    78
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    79
namespace aux {
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    80
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    81
template< bool C >
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    82
struct if_impl
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    83
{
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    84
    template< typename T1, typename T2 > struct result_
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    85
    {
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    86
        typedef T1 type;
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    87
    };
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    88
};
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    89
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    90
template<>
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    91
struct if_impl<false>
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    92
{
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    93
    template< typename T1, typename T2 > struct result_
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    94
    { 
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    95
        typedef T2 type;
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    96
    };
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    97
};
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    98
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
    99
} // namespace aux
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
   100
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
   101
template<
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
   102
      bool C_
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
   103
    , typename T1
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
   104
    , typename T2
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
   105
    >
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
   106
struct if_c
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
   107
{
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
   108
    typedef typename aux::if_impl< C_ >
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
   109
        ::template result_<T1,T2>::type type;
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
   110
};
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
   111
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
   112
// (almost) copy & paste in order to save one more 
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
   113
// recursively nested template instantiation to user
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
   114
template<
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
   115
      typename BOOST_MPL_AUX_NA_PARAM(C_)
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
   116
    , typename BOOST_MPL_AUX_NA_PARAM(T1)
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
   117
    , typename BOOST_MPL_AUX_NA_PARAM(T2)
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
   118
    >
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
   119
struct if_
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
   120
{
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
   121
    enum { msvc_wknd_ = BOOST_MPL_AUX_MSVC_VALUE_WKND(C_)::value };
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
   122
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
   123
    typedef typename aux::if_impl< BOOST_MPL_AUX_STATIC_CAST(bool, msvc_wknd_) >
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
   124
        ::template result_<T1,T2>::type type;
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
   125
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
   126
    BOOST_MPL_AUX_LAMBDA_SUPPORT(3,if_,(C_,T1,T2))
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
   127
};
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
   128
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
   129
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
   130
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
   131
BOOST_MPL_AUX_NA_SPEC(3, if_)
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
   132
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
   133
}}
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
   134
39c28ec933dd Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff changeset
   135
#endif // BOOST_MPL_IF_HPP_INCLUDED