os/ossrv/ossrv_pub/boost_apis/boost/mpl/quote.hpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
sl@0
     2
#if !defined(BOOST_PP_IS_ITERATING)
sl@0
     3
sl@0
     4
///// header body
sl@0
     5
sl@0
     6
#ifndef BOOST_MPL_QUOTE_HPP_INCLUDED
sl@0
     7
#define BOOST_MPL_QUOTE_HPP_INCLUDED
sl@0
     8
sl@0
     9
// Copyright Aleksey Gurtovoy 2000-2004
sl@0
    10
//
sl@0
    11
// Distributed under the Boost Software License, Version 1.0. 
sl@0
    12
// (See accompanying file LICENSE_1_0.txt or copy at 
sl@0
    13
// http://www.boost.org/LICENSE_1_0.txt)
sl@0
    14
//
sl@0
    15
// See http://www.boost.org/libs/mpl for documentation.
sl@0
    16
sl@0
    17
// $Source: /cvsroot/boost/boost/boost/mpl/quote.hpp,v $
sl@0
    18
// $Date: 2006/05/03 03:27:58 $
sl@0
    19
// $Revision: 1.5.14.2 $
sl@0
    20
sl@0
    21
#if !defined(BOOST_MPL_PREPROCESSING_MODE)
sl@0
    22
#   include <boost/mpl/void.hpp>
sl@0
    23
#   include <boost/mpl/aux_/has_type.hpp>
sl@0
    24
#endif
sl@0
    25
sl@0
    26
#include <boost/mpl/aux_/config/ttp.hpp>
sl@0
    27
sl@0
    28
#if defined(BOOST_MPL_CFG_NO_TEMPLATE_TEMPLATE_PARAMETERS)
sl@0
    29
#   define BOOST_MPL_CFG_NO_QUOTE_TEMPLATE
sl@0
    30
#endif
sl@0
    31
sl@0
    32
#if !defined(BOOST_MPL_CFG_NO_IMPLICIT_METAFUNCTIONS) \
sl@0
    33
    && defined(BOOST_MPL_CFG_NO_HAS_XXX)
sl@0
    34
#   define BOOST_MPL_CFG_NO_IMPLICIT_METAFUNCTIONS
sl@0
    35
#endif
sl@0
    36
sl@0
    37
#include <boost/mpl/aux_/config/use_preprocessed.hpp>
sl@0
    38
sl@0
    39
#if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \
sl@0
    40
 && !defined(BOOST_MPL_PREPROCESSING_MODE)
sl@0
    41
sl@0
    42
#   define BOOST_MPL_PREPROCESSED_HEADER quote.hpp
sl@0
    43
#   include <boost/mpl/aux_/include_preprocessed.hpp>
sl@0
    44
sl@0
    45
#else
sl@0
    46
sl@0
    47
#   include <boost/mpl/limits/arity.hpp>
sl@0
    48
#   include <boost/mpl/aux_/preprocessor/params.hpp>
sl@0
    49
#   include <boost/mpl/aux_/config/ctps.hpp>
sl@0
    50
#   include <boost/mpl/aux_/config/workaround.hpp>
sl@0
    51
sl@0
    52
#   include <boost/preprocessor/iterate.hpp>
sl@0
    53
#   include <boost/preprocessor/cat.hpp>
sl@0
    54
sl@0
    55
#if !defined(BOOST_MPL_CFG_NO_QUOTE_TEMPLATE)
sl@0
    56
sl@0
    57
namespace boost { namespace mpl {
sl@0
    58
sl@0
    59
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
sl@0
    60
sl@0
    61
template< typename T, bool has_type_ >
sl@0
    62
struct quote_impl
sl@0
    63
// GCC has a problem with metafunction forwarding when T is a
sl@0
    64
// specialization of a template called 'type'.
sl@0
    65
# if BOOST_WORKAROUND(__GNUC__, BOOST_TESTED_AT(4)) \
sl@0
    66
    && BOOST_WORKAROUND(__GNUC_MINOR__, BOOST_TESTED_AT(0)) \
sl@0
    67
    && BOOST_WORKAROUND(__GNUC_PATCHLEVEL__, BOOST_TESTED_AT(2))
sl@0
    68
{
sl@0
    69
    typedef typename T::type type;
sl@0
    70
};
sl@0
    71
# else 
sl@0
    72
    : T
sl@0
    73
{
sl@0
    74
};
sl@0
    75
# endif 
sl@0
    76
sl@0
    77
template< typename T >
sl@0
    78
struct quote_impl<T,false>
sl@0
    79
{
sl@0
    80
    typedef T type;
sl@0
    81
};
sl@0
    82
sl@0
    83
#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
sl@0
    84
sl@0
    85
template< bool > struct quote_impl
sl@0
    86
{
sl@0
    87
    template< typename T > struct result_
sl@0
    88
        : T
sl@0
    89
    {
sl@0
    90
    };
sl@0
    91
};
sl@0
    92
sl@0
    93
template<> struct quote_impl<false>
sl@0
    94
{
sl@0
    95
    template< typename T > struct result_
sl@0
    96
    {
sl@0
    97
        typedef T type;
sl@0
    98
    };
sl@0
    99
};
sl@0
   100
sl@0
   101
#endif 
sl@0
   102
sl@0
   103
#define BOOST_PP_ITERATION_PARAMS_1 \
sl@0
   104
    (3,(1, BOOST_MPL_LIMIT_METAFUNCTION_ARITY, <boost/mpl/quote.hpp>))
sl@0
   105
#include BOOST_PP_ITERATE()
sl@0
   106
sl@0
   107
}}
sl@0
   108
sl@0
   109
#endif // BOOST_MPL_CFG_NO_QUOTE_TEMPLATE
sl@0
   110
sl@0
   111
#endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
sl@0
   112
#endif // BOOST_MPL_QUOTE_HPP_INCLUDED
sl@0
   113
sl@0
   114
///// iteration
sl@0
   115
sl@0
   116
#else
sl@0
   117
#define i_ BOOST_PP_FRAME_ITERATION(1)
sl@0
   118
sl@0
   119
template<
sl@0
   120
      template< BOOST_MPL_PP_PARAMS(i_, typename P) > class F
sl@0
   121
    , typename Tag = void_
sl@0
   122
    >
sl@0
   123
struct BOOST_PP_CAT(quote,i_)
sl@0
   124
{
sl@0
   125
    template< BOOST_MPL_PP_PARAMS(i_, typename U) > struct apply
sl@0
   126
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
sl@0
   127
        : quote_impl<
sl@0
   128
              F< BOOST_MPL_PP_PARAMS(i_, U) >
sl@0
   129
            , aux::has_type< F< BOOST_MPL_PP_PARAMS(i_, U) > >::value
sl@0
   130
            >
sl@0
   131
#else
sl@0
   132
        : quote_impl< aux::has_type< F< BOOST_MPL_PP_PARAMS(i_, U) > >::value >
sl@0
   133
            ::template result_< F< BOOST_MPL_PP_PARAMS(i_, U) > >
sl@0
   134
#endif
sl@0
   135
    {
sl@0
   136
    };
sl@0
   137
};
sl@0
   138
sl@0
   139
#undef i_
sl@0
   140
#endif // BOOST_PP_IS_ITERATING