blob: 59b7d3ad7075047eb7caa1bedea9f42596ded5c2 [file] [log] [blame]
Jeff Thompsona28eed82013-08-22 16:21:10 -07001
Jeff Thompson3d613fd2013-10-15 15:39:04 -07002#if !defined(NDNBOOST_PP_IS_ITERATING)
Jeff Thompsona28eed82013-08-22 16:21:10 -07003
4///// header body
5
Jeff Thompson3d613fd2013-10-15 15:39:04 -07006#ifndef NDNBOOST_MPL_QUOTE_HPP_INCLUDED
7#define NDNBOOST_MPL_QUOTE_HPP_INCLUDED
Jeff Thompsona28eed82013-08-22 16:21:10 -07008
9// Copyright Aleksey Gurtovoy 2000-2008
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// $Id: quote.hpp 49272 2008-10-11 06:50:46Z agurtovoy $
18// $Date: 2008-10-10 23:50:46 -0700 (Fri, 10 Oct 2008) $
19// $Revision: 49272 $
20
Jeff Thompson3d613fd2013-10-15 15:39:04 -070021#if !defined(NDNBOOST_MPL_PREPROCESSING_MODE)
Jeff Thompsona28eed82013-08-22 16:21:10 -070022# include <ndnboost/mpl/void.hpp>
23# include <ndnboost/mpl/aux_/has_type.hpp>
24#endif
25
26#include <ndnboost/mpl/aux_/config/bcc.hpp>
27#include <ndnboost/mpl/aux_/config/ttp.hpp>
28
Jeff Thompson3d613fd2013-10-15 15:39:04 -070029#if defined(NDNBOOST_MPL_CFG_NO_TEMPLATE_TEMPLATE_PARAMETERS) \
30 && !defined(NDNBOOST_MPL_CFG_BCC590_WORKAROUNDS)
31# define NDNBOOST_MPL_CFG_NO_QUOTE_TEMPLATE
Jeff Thompsona28eed82013-08-22 16:21:10 -070032#endif
33
Jeff Thompson3d613fd2013-10-15 15:39:04 -070034#if !defined(NDNBOOST_MPL_CFG_NO_IMPLICIT_METAFUNCTIONS) \
35 && defined(NDNBOOST_MPL_CFG_NO_HAS_XXX)
36# define NDNBOOST_MPL_CFG_NO_IMPLICIT_METAFUNCTIONS
Jeff Thompsona28eed82013-08-22 16:21:10 -070037#endif
38
39#include <ndnboost/mpl/aux_/config/use_preprocessed.hpp>
40
Jeff Thompson3d613fd2013-10-15 15:39:04 -070041#if !defined(NDNBOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \
42 && !defined(NDNBOOST_MPL_PREPROCESSING_MODE)
Jeff Thompsona28eed82013-08-22 16:21:10 -070043
Jeff Thompson3d613fd2013-10-15 15:39:04 -070044# define NDNBOOST_MPL_PREPROCESSED_HEADER quote.hpp
Jeff Thompsona28eed82013-08-22 16:21:10 -070045# include <ndnboost/mpl/aux_/include_preprocessed.hpp>
46
47#else
48
49# include <ndnboost/mpl/limits/arity.hpp>
50# include <ndnboost/mpl/aux_/preprocessor/params.hpp>
51# include <ndnboost/mpl/aux_/config/ctps.hpp>
52# include <ndnboost/mpl/aux_/config/workaround.hpp>
53
54# include <ndnboost/preprocessor/iterate.hpp>
55# include <ndnboost/preprocessor/cat.hpp>
56
Jeff Thompson3d613fd2013-10-15 15:39:04 -070057#if !defined(NDNBOOST_MPL_CFG_NO_QUOTE_TEMPLATE)
Jeff Thompsona28eed82013-08-22 16:21:10 -070058
59namespace ndnboost { namespace mpl {
60
Jeff Thompson3d613fd2013-10-15 15:39:04 -070061#if !defined(NDNBOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
Jeff Thompsona28eed82013-08-22 16:21:10 -070062
63template< typename T, bool has_type_ >
64struct quote_impl
65// GCC has a problem with metafunction forwarding when T is a
66// specialization of a template called 'type'.
Jeff Thompson3d613fd2013-10-15 15:39:04 -070067# if NDNBOOST_WORKAROUND(__GNUC__, NDNBOOST_TESTED_AT(4)) \
68 && NDNBOOST_WORKAROUND(__GNUC_MINOR__, NDNBOOST_TESTED_AT(0)) \
69 && NDNBOOST_WORKAROUND(__GNUC_PATCHLEVEL__, NDNBOOST_TESTED_AT(2))
Jeff Thompsona28eed82013-08-22 16:21:10 -070070{
71 typedef typename T::type type;
72};
73# else
74 : T
75{
76};
77# endif
78
79template< typename T >
80struct quote_impl<T,false>
81{
82 typedef T type;
83};
84
Jeff Thompson3d613fd2013-10-15 15:39:04 -070085#else // NDNBOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
Jeff Thompsona28eed82013-08-22 16:21:10 -070086
87template< bool > struct quote_impl
88{
89 template< typename T > struct result_
90 : T
91 {
92 };
93};
94
95template<> struct quote_impl<false>
96{
97 template< typename T > struct result_
98 {
99 typedef T type;
100 };
101};
102
103#endif
104
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700105#define NDNBOOST_PP_ITERATION_PARAMS_1 \
106 (3,(1, NDNBOOST_MPL_LIMIT_METAFUNCTION_ARITY, <ndnboost/mpl/quote.hpp>))
107#include NDNBOOST_PP_ITERATE()
Jeff Thompsona28eed82013-08-22 16:21:10 -0700108
109}}
110
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700111#endif // NDNBOOST_MPL_CFG_NO_QUOTE_TEMPLATE
Jeff Thompsona28eed82013-08-22 16:21:10 -0700112
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700113#endif // NDNBOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
114#endif // NDNBOOST_MPL_QUOTE_HPP_INCLUDED
Jeff Thompsona28eed82013-08-22 16:21:10 -0700115
116///// iteration
117
118#else
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700119#define i_ NDNBOOST_PP_FRAME_ITERATION(1)
Jeff Thompsona28eed82013-08-22 16:21:10 -0700120
121template<
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700122 template< NDNBOOST_MPL_PP_PARAMS(i_, typename P) > class F
Jeff Thompsona28eed82013-08-22 16:21:10 -0700123 , typename Tag = void_
124 >
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700125struct NDNBOOST_PP_CAT(quote,i_)
Jeff Thompsona28eed82013-08-22 16:21:10 -0700126{
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700127 template< NDNBOOST_MPL_PP_PARAMS(i_, typename U) > struct apply
128#if defined(NDNBOOST_MPL_CFG_BCC590_WORKAROUNDS)
Jeff Thompsona28eed82013-08-22 16:21:10 -0700129 {
130 typedef typename quote_impl<
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700131 F< NDNBOOST_MPL_PP_PARAMS(i_, U) >
132 , aux::has_type< F< NDNBOOST_MPL_PP_PARAMS(i_, U) > >::value
Jeff Thompsona28eed82013-08-22 16:21:10 -0700133 >::type type;
134 };
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700135#elif !defined(NDNBOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
Jeff Thompsona28eed82013-08-22 16:21:10 -0700136 : quote_impl<
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700137 F< NDNBOOST_MPL_PP_PARAMS(i_, U) >
138 , aux::has_type< F< NDNBOOST_MPL_PP_PARAMS(i_, U) > >::value
Jeff Thompsona28eed82013-08-22 16:21:10 -0700139 >
140 {
141 };
142#else
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700143 : quote_impl< aux::has_type< F< NDNBOOST_MPL_PP_PARAMS(i_, U) > >::value >
144 ::template result_< F< NDNBOOST_MPL_PP_PARAMS(i_, U) > >
Jeff Thompsona28eed82013-08-22 16:21:10 -0700145 {
146 };
147#endif
148};
149
150#undef i_
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700151#endif // NDNBOOST_PP_IS_ITERATING