Files
boost_mpl/include/boost/mpl/quote.hpp
T

131 lines
2.9 KiB
C++
Raw Normal View History

2003-08-04 02:03:46 +00:00
#if !defined(BOOST_PP_IS_ITERATING)
///// header body
#ifndef BOOST_MPL_QUOTE_HPP_INCLUDED
#define BOOST_MPL_QUOTE_HPP_INCLUDED
2004-09-02 15:41:37 +00:00
// Copyright Aleksey Gurtovoy 2000-2004
2002-09-15 22:13:24 +00:00
//
2004-09-02 15:41:37 +00:00
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
2003-08-04 02:03:46 +00:00
//
// See http://www.boost.org/libs/mpl for documentation.
2002-12-17 10:42:05 +00:00
2004-09-02 15:41:37 +00:00
// $Source$
// $Date$
// $Revision$
2002-12-17 10:42:05 +00:00
#if !defined(BOOST_MPL_PREPROCESSING_MODE)
2004-09-02 15:41:37 +00:00
# include <boost/mpl/void.hpp>
# include <boost/mpl/aux_/has_type.hpp>
2002-12-17 10:42:05 +00:00
#endif
2002-09-15 22:13:24 +00:00
2004-09-02 15:41:37 +00:00
#include <boost/mpl/aux_/config/ttp.hpp>
2002-09-15 22:13:24 +00:00
2004-09-02 15:41:37 +00:00
#if defined(BOOST_MPL_CFG_NO_TEMPLATE_TEMPLATE_PARAMETERS)
# define BOOST_MPL_CFG_NO_QUOTE_TEMPLATE
#endif
#if !defined(BOOST_MPL_CFG_NO_IMPLICIT_METAFUNCTIONS) \
&& defined(BOOST_MPL_CFG_NO_HAS_XXX)
# define BOOST_MPL_CFG_NO_IMPLICIT_METAFUNCTIONS
#endif
#include <boost/mpl/aux_/config/use_preprocessed.hpp>
#if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \
2002-12-17 10:42:05 +00:00
&& !defined(BOOST_MPL_PREPROCESSING_MODE)
2002-09-15 22:13:24 +00:00
2002-12-17 10:42:05 +00:00
# define BOOST_MPL_PREPROCESSED_HEADER quote.hpp
2004-09-02 15:41:37 +00:00
# include <boost/mpl/aux_/include_preprocessed.hpp>
2002-09-15 22:13:24 +00:00
#else
2004-09-02 15:41:37 +00:00
# include <boost/mpl/limits/arity.hpp>
# include <boost/mpl/aux_/preprocessor/params.hpp>
# include <boost/mpl/aux_/config/ctps.hpp>
# include <boost/mpl/aux_/config/workaround.hpp>
2002-09-15 22:13:24 +00:00
2004-09-02 15:41:37 +00:00
# include <boost/preprocessor/iterate.hpp>
# include <boost/preprocessor/cat.hpp>
2002-09-15 22:13:24 +00:00
2004-09-02 15:41:37 +00:00
#if !defined(BOOST_MPL_CFG_NO_QUOTE_TEMPLATE)
2002-09-15 22:13:24 +00:00
2004-09-02 15:41:37 +00:00
namespace boost { namespace mpl {
2002-09-15 22:13:24 +00:00
2002-12-17 10:42:05 +00:00
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
2004-09-02 15:41:37 +00:00
template< typename T, bool has_type_ >
2002-12-17 10:42:05 +00:00
struct quote_impl
: T
{
};
template< typename T >
struct quote_impl<T,false>
{
typedef T type;
};
2004-09-02 15:41:37 +00:00
#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
2002-12-17 10:42:05 +00:00
template< bool > struct quote_impl
{
template< typename T > struct result_
: T
{
};
};
template<> struct quote_impl<false>
{
template< typename T > struct result_
{
typedef T type;
};
};
2004-09-02 15:41:37 +00:00
#endif
2002-12-17 10:42:05 +00:00
2002-09-15 22:13:24 +00:00
#define BOOST_PP_ITERATION_PARAMS_1 \
2004-09-02 15:41:37 +00:00
(3,(1, BOOST_MPL_LIMIT_METAFUNCTION_ARITY, <boost/mpl/quote.hpp>))
2002-09-15 22:13:24 +00:00
#include BOOST_PP_ITERATE()
2004-09-02 15:41:37 +00:00
}}
2002-09-15 22:13:24 +00:00
2004-09-02 15:41:37 +00:00
#endif // BOOST_MPL_CFG_NO_QUOTE_TEMPLATE
2002-09-15 22:13:24 +00:00
2004-09-02 15:41:37 +00:00
#endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
2002-12-17 10:42:05 +00:00
#endif // BOOST_MPL_QUOTE_HPP_INCLUDED
2002-09-15 22:13:24 +00:00
///// iteration
#else
2004-09-02 15:41:37 +00:00
#define i_ BOOST_PP_FRAME_ITERATION(1)
2002-09-15 22:13:24 +00:00
template<
2004-09-02 15:41:37 +00:00
template< BOOST_MPL_PP_PARAMS(i_, typename P) > class F
2003-08-04 02:03:46 +00:00
, typename Tag = void_
2002-09-15 22:13:24 +00:00
>
2004-09-02 15:41:37 +00:00
struct BOOST_PP_CAT(quote,i_)
2002-09-15 22:13:24 +00:00
{
2004-09-02 15:41:37 +00:00
template< BOOST_MPL_PP_PARAMS(i_, typename U) > struct apply
2002-12-17 10:42:05 +00:00
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
2004-09-02 15:41:37 +00:00
: quote_impl<
F< BOOST_MPL_PP_PARAMS(i_, U) >
, aux::has_type< F< BOOST_MPL_PP_PARAMS(i_, U) > >::value
>
2002-12-17 10:42:05 +00:00
#else
2004-09-02 15:41:37 +00:00
: quote_impl< aux::has_type< F< BOOST_MPL_PP_PARAMS(i_, U) > >::value >
::template result_< F< BOOST_MPL_PP_PARAMS(i_, U) > >
2002-12-17 10:42:05 +00:00
#endif
2002-09-15 22:13:24 +00:00
{
};
};
2004-09-02 15:41:37 +00:00
#undef i_
2002-09-15 22:13:24 +00:00
#endif // BOOST_PP_IS_ITERATING