1 /* Copyright 2006-2008 Joaquin M Lopez Munoz.
2 * Distributed under the Boost Software License, Version 1.0.
3 * (See accompanying file LICENSE_1_0.txt or copy at
4 * http://www.boost.org/LICENSE_1_0.txt)
6 * See http://www.boost.org/libs/flyweight for library home page.
9 #ifndef BOOST_FLYWEIGHT_DETAIL_NOT_PLACEHOLDER_EXPR_HPP
10 #define BOOST_FLYWEIGHT_DETAIL_NOT_PLACEHOLDER_EXPR_HPP
16 /* BOOST_FLYWEIGHT_NOT_A_PLACEHOLDER_EXPRESSION can be inserted at the end
17 * of a class template parameter declaration:
19 * typename X0,...,typename Xn
20 * BOOST_FLYWEIGHT_NOT_A_PLACEHOLDER_EXPRESSION
23 * to prevent instantiations from being treated as MPL placeholder
24 * expressions in the presence of placeholder arguments; this is useful
25 * to avoid masking of a metafunction class nested ::apply during
29 #include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
30 #include <boost/detail/workaround.hpp>
32 #if BOOST_WORKAROUND(__GNUC__, <4)||\
33 BOOST_WORKAROUND(__GNUC__,==4)&&(__GNUC_MINOR__<2)
34 /* The default trick on which the macro is based, namely adding a int=0
35 * defaulted template parameter, does not work in GCC prior to 4.2 due to
36 * an unfortunate compiler non-standard extension, as explained in
37 * http://lists.boost.org/boost-users/2007/07/29866.php
38 * We resort to an uglier technique, adding defaulted template parameters
39 * so as to exceed BOOST_MPL_LIMIT_METAFUNCTION_ARITY.
42 #include <boost/mpl/limits/arity.hpp>
43 #include <boost/preprocessor/facilities/intercept.hpp>
44 #include <boost/preprocessor/repetition/enum_trailing_params.hpp>
46 #define BOOST_FLYWEIGHT_NOT_A_PLACEHOLDER_EXPRESSION \
47 BOOST_PP_ENUM_TRAILING_PARAMS( \
48 BOOST_MPL_LIMIT_METAFUNCTION_ARITY,typename=int BOOST_PP_INTERCEPT)
49 #define BOOST_FLYWEIGHT_NOT_A_PLACEHOLDER_EXPRESSION_DEF \
50 BOOST_PP_ENUM_TRAILING_PARAMS( \
51 BOOST_MPL_LIMIT_METAFUNCTION_ARITY,typename BOOST_PP_INTERCEPT)
54 #define BOOST_FLYWEIGHT_NOT_A_PLACEHOLDER_EXPRESSION ,int=0
55 #define BOOST_FLYWEIGHT_NOT_A_PLACEHOLDER_EXPRESSION_DEF ,int