1
0
forked from boostorg/mpl
Files
boost_mpl/include/boost/mpl/aux_/lambda_support.hpp
T

162 lines
4.9 KiB
C++
Raw Normal View History

2002-09-15 22:13:24 +00:00
#ifndef BOOST_MPL_AUX_LAMBDA_SUPPORT_HPP_INCLUDED
#define BOOST_MPL_AUX_LAMBDA_SUPPORT_HPP_INCLUDED
2004-09-02 15:41:37 +00:00
// Copyright Aleksey Gurtovoy 2001-2004
//
// 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)
//
// See http://www.boost.org/libs/mpl for documentation.
2002-09-15 22:13:24 +00:00
2004-09-02 15:41:37 +00:00
// $Source$
// $Date$
// $Revision$
#include <boost/mpl/aux_/config/lambda.hpp>
#if !defined(BOOST_MPL_CFG_NO_FULL_LAMBDA_SUPPORT)
2002-09-15 22:13:24 +00:00
2002-12-09 08:08:30 +00:00
# define BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(i, name, params) /**/
2002-09-15 22:13:24 +00:00
# define BOOST_MPL_AUX_LAMBDA_SUPPORT(i,name,params) /**/
#else
2004-09-02 15:41:37 +00:00
# include <boost/mpl/int_fwd.hpp>
# include <boost/mpl/aux_/preprocessor/params.hpp>
# include <boost/mpl/aux_/config/msvc.hpp>
# include <boost/mpl/aux_/config/workaround.hpp>
# include <boost/preprocessor/tuple/to_list.hpp>
# include <boost/preprocessor/list/for_each_i.hpp>
# include <boost/preprocessor/inc.hpp>
# include <boost/preprocessor/cat.hpp>
2002-09-15 22:13:24 +00:00
# define BOOST_MPL_AUX_LAMBDA_SUPPORT_ARG_TYPEDEF_FUNC(R,typedef_,i,param) \
typedef_ param BOOST_PP_CAT(arg,BOOST_PP_INC(i)); \
/**/
2003-03-07 11:38:59 +00:00
// agurt, 07/mar/03: restore an old revision for the sake of SGI MIPSpro C++
#if BOOST_WORKAROUND(__EDG_VERSION__, <= 238)
# define BOOST_MPL_AUX_LAMBDA_SUPPORT(i, name, params) \
2004-09-02 15:41:37 +00:00
typedef BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE::int_<i> arity; \
2003-03-07 11:38:59 +00:00
BOOST_PP_LIST_FOR_EACH_I_R( \
1 \
, BOOST_MPL_AUX_LAMBDA_SUPPORT_ARG_TYPEDEF_FUNC \
, typedef \
, BOOST_PP_TUPLE_TO_LIST(i,params) \
) \
struct rebind \
{ \
template< BOOST_MPL_PP_PARAMS(i,typename U) > struct apply \
: name< BOOST_MPL_PP_PARAMS(i,U) > \
{ \
}; \
}; \
/**/
# define BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(i, name, params) \
BOOST_MPL_AUX_LAMBDA_SUPPORT(i, name, params) \
/**/
#elif BOOST_WORKAROUND(__EDG_VERSION__, <= 244) && !defined(BOOST_INTEL_CXX_VERSION)
2003-01-18 22:18:32 +00:00
// agurt, 18/jan/03: old EDG-based compilers actually enforce 11.4 para 9
// (in strict mode), so we have to provide an alternative to the
// MSVC-optimized implementation
# define BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(i, name, params) \
2004-09-02 15:41:37 +00:00
typedef BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE::int_<i> arity; \
2003-01-18 22:18:32 +00:00
BOOST_PP_LIST_FOR_EACH_I_R( \
1 \
, BOOST_MPL_AUX_LAMBDA_SUPPORT_ARG_TYPEDEF_FUNC \
, typedef \
, BOOST_PP_TUPLE_TO_LIST(i,params) \
) \
struct rebind; \
/**/
# define BOOST_MPL_AUX_LAMBDA_SUPPORT(i, name, params) \
BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(i, name, params) \
}; \
template< BOOST_MPL_PP_PARAMS(i,typename T) > \
struct name<BOOST_MPL_PP_PARAMS(i,T)>::rebind \
{ \
template< BOOST_MPL_PP_PARAMS(i,typename U) > struct apply \
: name< BOOST_MPL_PP_PARAMS(i,U) > \
{ \
}; \
/**/
#else // __EDG_VERSION__
2004-09-02 15:41:37 +00:00
namespace boost { namespace mpl { namespace aux {
template< typename T > struct has_rebind_tag;
}}}
2002-12-09 08:08:30 +00:00
# define BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(i, name, params) \
2004-09-02 15:41:37 +00:00
typedef BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE::int_<i> arity; \
2002-12-09 08:08:30 +00:00
BOOST_PP_LIST_FOR_EACH_I_R( \
1 \
, BOOST_MPL_AUX_LAMBDA_SUPPORT_ARG_TYPEDEF_FUNC \
, typedef \
, BOOST_PP_TUPLE_TO_LIST(i,params) \
) \
friend class BOOST_PP_CAT(name,_rebind); \
typedef BOOST_PP_CAT(name,_rebind) rebind; \
/**/
2004-09-02 15:41:37 +00:00
#if BOOST_WORKAROUND(__BORLANDC__, < 0x600)
# define BOOST_MPL_AUX_LAMBDA_SUPPORT_HAS_REBIND(i, name, params) \
template< BOOST_MPL_PP_PARAMS(i,typename T) > \
char operator|( \
::boost::mpl::aux::has_rebind_tag<int> \
, name<BOOST_MPL_PP_PARAMS(i,T)>* \
); \
/**/
#elif !BOOST_WORKAROUND(BOOST_MSVC, <= 1200)
# define BOOST_MPL_AUX_LAMBDA_SUPPORT_HAS_REBIND(i, name, params) \
template< BOOST_MPL_PP_PARAMS(i,typename T) > \
char operator|( \
::boost::mpl::aux::has_rebind_tag<int> \
, ::boost::mpl::aux::has_rebind_tag< name<BOOST_MPL_PP_PARAMS(i,T)> >* \
); \
/**/
#else
# define BOOST_MPL_AUX_LAMBDA_SUPPORT_HAS_REBIND(i, name, params) /**/
#endif
2003-01-18 22:18:32 +00:00
# if !defined(__BORLANDC__)
2002-12-09 08:08:30 +00:00
# define BOOST_MPL_AUX_LAMBDA_SUPPORT(i, name, params) \
BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(i, name, params) \
}; \
2004-09-02 15:41:37 +00:00
BOOST_MPL_AUX_LAMBDA_SUPPORT_HAS_REBIND(i, name, params) \
2002-12-09 22:46:24 +00:00
class BOOST_PP_CAT(name,_rebind) \
2002-12-09 08:08:30 +00:00
{ \
2002-12-09 22:46:24 +00:00
public: \
2002-12-09 08:08:30 +00:00
template< BOOST_MPL_PP_PARAMS(i,typename U) > struct apply \
: name< BOOST_MPL_PP_PARAMS(i,U) > \
2002-09-15 22:13:24 +00:00
{ \
}; \
2002-12-09 08:08:30 +00:00
/**/
2003-01-18 22:18:32 +00:00
# else
2002-12-09 08:08:30 +00:00
# define BOOST_MPL_AUX_LAMBDA_SUPPORT(i, name, params) \
BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(i, name, params) \
}; \
2004-09-02 15:41:37 +00:00
BOOST_MPL_AUX_LAMBDA_SUPPORT_HAS_REBIND(i, name, params) \
2002-12-09 22:46:24 +00:00
class BOOST_PP_CAT(name,_rebind) \
2002-12-09 08:08:30 +00:00
{ \
2002-12-09 22:46:24 +00:00
public: \
2002-12-09 08:08:30 +00:00
template< BOOST_MPL_PP_PARAMS(i,typename U) > struct apply \
{ \
typedef typename name< BOOST_MPL_PP_PARAMS(i,U) >::type type; \
}; \
/**/
2003-01-18 22:18:32 +00:00
# endif // __BORLANDC__
#endif // __EDG_VERSION__
2002-09-15 22:13:24 +00:00
2004-09-02 15:41:37 +00:00
#endif // BOOST_MPL_CFG_NO_FULL_LAMBDA_SUPPORT
2002-09-15 22:13:24 +00:00
#endif // BOOST_MPL_AUX_LAMBDA_SUPPORT_HPP_INCLUDED