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