Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:30:52

0001 /* Copyright 2006-2018 Joaquin M Lopez Munoz.
0002  * Distributed under the Boost Software License, Version 1.0.
0003  * (See accompanying file LICENSE_1_0.txt or copy at
0004  * http://www.boost.org/LICENSE_1_0.txt)
0005  *
0006  * See http://www.boost.org/libs/flyweight for library home page.
0007  */
0008 
0009 #ifndef BOOST_FLYWEIGHT_DETAIL_NOT_PLACEHOLDER_EXPR_HPP
0010 #define BOOST_FLYWEIGHT_DETAIL_NOT_PLACEHOLDER_EXPR_HPP
0011 
0012 #if defined(_MSC_VER)
0013 #pragma once
0014 #endif
0015 
0016 /* BOOST_FLYWEIGHT_NOT_A_PLACEHOLDER_EXPRESSION can be inserted at the end
0017  * of a class template parameter declaration:
0018  *   template<
0019  *     typename X0,...,typename Xn
0020  *     BOOST_FLYWEIGHT_NOT_A_PLACEHOLDER_EXPRESSION  
0021  *   >
0022  *   struct foo...
0023  * to prevent instantiations from being treated as MPL placeholder
0024  * expressions in the presence of placeholder arguments; this is useful
0025  * to avoid masking of a metafunction class nested ::apply during
0026  * MPL invocation.
0027  */
0028 
0029 #include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
0030 #include <boost/detail/workaround.hpp>
0031 
0032 #if BOOST_WORKAROUND(__GNUC__, <4)||\
0033     BOOST_WORKAROUND(__GNUC__,==4)&&(__GNUC_MINOR__<2)||\
0034     BOOST_WORKAROUND(__GNUC__, ==7)&&( __cplusplus>=201703L)||\
0035     BOOST_WORKAROUND(__GNUC__, >=8)&&( __cplusplus>=201103L)
0036 /* The default trick on which the macro is based, namely adding a int=0
0037  * defaulted template parameter, does not work in GCC prior to 4.2 due to
0038  * an unfortunate compiler non-standard extension, as explained in
0039  *   http://lists.boost.org/boost-users/2007/07/29866.php
0040  * As it happens, GCC 7 in C++17 mode and GCC 8 (and presumably later) in
0041  * C++11 mode (and presumably later) go back to this old behavior, anticipating
0042  * the resolution of CWG DR 150 (see P0522R0).
0043  * In these cases we resort to an uglier technique, adding defaulted template
0044  * parameters so as to exceed BOOST_MPL_LIMIT_METAFUNCTION_ARITY.
0045  */
0046 
0047 #include <boost/mpl/limits/arity.hpp>
0048 #include <boost/preprocessor/facilities/intercept.hpp>
0049 #include <boost/preprocessor/repetition/enum_trailing_params.hpp>
0050 
0051 #define BOOST_FLYWEIGHT_NOT_A_PLACEHOLDER_EXPRESSION                  \
0052 BOOST_PP_ENUM_TRAILING_PARAMS(                                        \
0053   BOOST_MPL_LIMIT_METAFUNCTION_ARITY,typename=int BOOST_PP_INTERCEPT)
0054 #define BOOST_FLYWEIGHT_NOT_A_PLACEHOLDER_EXPRESSION_DEF              \
0055 BOOST_PP_ENUM_TRAILING_PARAMS(                                        \
0056   BOOST_MPL_LIMIT_METAFUNCTION_ARITY,typename BOOST_PP_INTERCEPT)
0057 
0058 #else
0059 #define BOOST_FLYWEIGHT_NOT_A_PLACEHOLDER_EXPRESSION  ,int=0
0060 #define BOOST_FLYWEIGHT_NOT_A_PLACEHOLDER_EXPRESSION_DEF  ,int
0061 #endif
0062 
0063 #endif