source: NonGTP/Boost/boost/mpl/quote.hpp @ 857

Revision 857, 3.1 KB checked in by igarcia, 18 years ago (diff)
Line 
1
2#if !defined(BOOST_PP_IS_ITERATING)
3
4///// header body
5
6#ifndef BOOST_MPL_QUOTE_HPP_INCLUDED
7#define BOOST_MPL_QUOTE_HPP_INCLUDED
8
9// Copyright Aleksey Gurtovoy 2000-2004
10//
11// Distributed under the Boost Software License, Version 1.0.
12// (See accompanying file LICENSE_1_0.txt or copy at
13// http://www.boost.org/LICENSE_1_0.txt)
14//
15// See http://www.boost.org/libs/mpl for documentation.
16
17// $Source: /cvsroot/boost/boost/boost/mpl/quote.hpp,v $
18// $Date: 2004/09/02 15:40:42 $
19// $Revision: 1.5 $
20
21#if !defined(BOOST_MPL_PREPROCESSING_MODE)
22#   include <boost/mpl/void.hpp>
23#   include <boost/mpl/aux_/has_type.hpp>
24#endif
25
26#include <boost/mpl/aux_/config/ttp.hpp>
27
28#if defined(BOOST_MPL_CFG_NO_TEMPLATE_TEMPLATE_PARAMETERS)
29#   define BOOST_MPL_CFG_NO_QUOTE_TEMPLATE
30#endif
31
32#if !defined(BOOST_MPL_CFG_NO_IMPLICIT_METAFUNCTIONS) \
33    && defined(BOOST_MPL_CFG_NO_HAS_XXX)
34#   define BOOST_MPL_CFG_NO_IMPLICIT_METAFUNCTIONS
35#endif
36
37#include <boost/mpl/aux_/config/use_preprocessed.hpp>
38
39#if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \
40 && !defined(BOOST_MPL_PREPROCESSING_MODE)
41
42#   define BOOST_MPL_PREPROCESSED_HEADER quote.hpp
43#   include <boost/mpl/aux_/include_preprocessed.hpp>
44
45#else
46
47#   include <boost/mpl/limits/arity.hpp>
48#   include <boost/mpl/aux_/preprocessor/params.hpp>
49#   include <boost/mpl/aux_/config/ctps.hpp>
50#   include <boost/mpl/aux_/config/workaround.hpp>
51
52#   include <boost/preprocessor/iterate.hpp>
53#   include <boost/preprocessor/cat.hpp>
54
55#if !defined(BOOST_MPL_CFG_NO_QUOTE_TEMPLATE)
56
57namespace boost { namespace mpl {
58
59#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
60
61template< typename T, bool has_type_ >
62struct quote_impl
63    : T
64{
65};
66
67template< typename T >
68struct quote_impl<T,false>
69{
70    typedef T type;
71};
72
73#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
74
75template< bool > struct quote_impl
76{
77    template< typename T > struct result_
78        : T
79    {
80    };
81};
82
83template<> struct quote_impl<false>
84{
85    template< typename T > struct result_
86    {
87        typedef T type;
88    };
89};
90
91#endif
92
93#define BOOST_PP_ITERATION_PARAMS_1 \
94    (3,(1, BOOST_MPL_LIMIT_METAFUNCTION_ARITY, <boost/mpl/quote.hpp>))
95#include BOOST_PP_ITERATE()
96
97}}
98
99#endif // BOOST_MPL_CFG_NO_QUOTE_TEMPLATE
100
101#endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
102#endif // BOOST_MPL_QUOTE_HPP_INCLUDED
103
104///// iteration
105
106#else
107#define i_ BOOST_PP_FRAME_ITERATION(1)
108
109template<
110      template< BOOST_MPL_PP_PARAMS(i_, typename P) > class F
111    , typename Tag = void_
112    >
113struct BOOST_PP_CAT(quote,i_)
114{
115    template< BOOST_MPL_PP_PARAMS(i_, typename U) > struct apply
116#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
117        : quote_impl<
118              F< BOOST_MPL_PP_PARAMS(i_, U) >
119            , aux::has_type< F< BOOST_MPL_PP_PARAMS(i_, U) > >::value
120            >
121#else
122        : quote_impl< aux::has_type< F< BOOST_MPL_PP_PARAMS(i_, U) > >::value >
123            ::template result_< F< BOOST_MPL_PP_PARAMS(i_, U) > >
124#endif
125    {
126    };
127};
128
129#undef i_
130#endif // BOOST_PP_IS_ITERATING
Note: See TracBrowser for help on using the repository browser.