Chris@16: /* Copyright 2006-2008 Joaquin M Lopez Munoz. Chris@16: * Distributed under the Boost Software License, Version 1.0. Chris@16: * (See accompanying file LICENSE_1_0.txt or copy at Chris@16: * http://www.boost.org/LICENSE_1_0.txt) Chris@16: * Chris@16: * See http://www.boost.org/libs/flyweight for library home page. Chris@16: */ Chris@16: Chris@16: #ifndef BOOST_FLYWEIGHT_DETAIL_NOT_PLACEHOLDER_EXPR_HPP Chris@16: #define BOOST_FLYWEIGHT_DETAIL_NOT_PLACEHOLDER_EXPR_HPP Chris@16: Chris@101: #if defined(_MSC_VER) Chris@16: #pragma once Chris@16: #endif Chris@16: Chris@16: /* BOOST_FLYWEIGHT_NOT_A_PLACEHOLDER_EXPRESSION can be inserted at the end Chris@16: * of a class template parameter declaration: Chris@16: * template< Chris@16: * typename X0,...,typename Xn Chris@16: * BOOST_FLYWEIGHT_NOT_A_PLACEHOLDER_EXPRESSION Chris@16: * > Chris@16: * struct foo... Chris@16: * to prevent instantiations from being treated as MPL placeholder Chris@16: * expressions in the presence of placeholder arguments; this is useful Chris@16: * to avoid masking of a metafunction class nested ::apply during Chris@16: * MPL invocation. Chris@16: */ Chris@16: Chris@16: #include /* keep it first to prevent nasty warns in MSVC */ Chris@16: #include Chris@16: Chris@16: #if BOOST_WORKAROUND(__GNUC__, <4)||\ Chris@16: BOOST_WORKAROUND(__GNUC__,==4)&&(__GNUC_MINOR__<2) Chris@16: /* The default trick on which the macro is based, namely adding a int=0 Chris@16: * defaulted template parameter, does not work in GCC prior to 4.2 due to Chris@16: * an unfortunate compiler non-standard extension, as explained in Chris@16: * http://lists.boost.org/boost-users/2007/07/29866.php Chris@16: * We resort to an uglier technique, adding defaulted template parameters Chris@16: * so as to exceed BOOST_MPL_LIMIT_METAFUNCTION_ARITY. Chris@16: */ Chris@16: Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: Chris@16: #define BOOST_FLYWEIGHT_NOT_A_PLACEHOLDER_EXPRESSION \ Chris@16: BOOST_PP_ENUM_TRAILING_PARAMS( \ Chris@16: BOOST_MPL_LIMIT_METAFUNCTION_ARITY,typename=int BOOST_PP_INTERCEPT) Chris@16: #define BOOST_FLYWEIGHT_NOT_A_PLACEHOLDER_EXPRESSION_DEF \ Chris@16: BOOST_PP_ENUM_TRAILING_PARAMS( \ Chris@16: BOOST_MPL_LIMIT_METAFUNCTION_ARITY,typename BOOST_PP_INTERCEPT) Chris@16: Chris@16: #else Chris@16: #define BOOST_FLYWEIGHT_NOT_A_PLACEHOLDER_EXPRESSION ,int=0 Chris@16: #define BOOST_FLYWEIGHT_NOT_A_PLACEHOLDER_EXPRESSION_DEF ,int Chris@16: #endif Chris@16: Chris@16: #endif