1 //////////////////////////////////////////////////////////////////////////////
3 // (C) Copyright Ion Gaztanaga 2008-2008. Distributed under the Boost
4 // Software License, Version 1.0. (See accompanying file
5 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 // See http://www.boost.org/libs/interprocess for documentation.
9 //////////////////////////////////////////////////////////////////////////////
11 #ifndef BOOST_INTERPROCESS_DETAIL_PREPROCESSOR_HPP
12 #define BOOST_INTERPROCESS_DETAIL_PREPROCESSOR_HPP
14 #if (defined _MSC_VER) && (_MSC_VER >= 1200)
18 #include <boost/interprocess/detail/config_begin.hpp>
19 #include <boost/interprocess/detail/workaround.hpp>
21 #ifdef BOOST_INTERPROCESS_PERFECT_FORWARDING
22 #error "This file is not needed when perfect forwarding is available"
25 #include <boost/preprocessor/iteration/local.hpp>
26 #include <boost/preprocessor/repetition/enum_params.hpp>
27 #include <boost/preprocessor/cat.hpp>
28 #include <boost/preprocessor/repetition/enum.hpp>
29 #include <boost/preprocessor/repetition/repeat.hpp>
31 #define BOOST_INTERPROCESS_MAX_CONSTRUCTOR_PARAMETERS 10
34 //We define template parameters as const references to
35 //be able to bind temporaries. After that we will un-const them.
36 //This cast is ugly but it is necessary until "perfect forwarding"
37 //is achieved in C++0x. Meanwhile, if we want to be able to
38 //bind rvalues with non-const references, we have to be ugly
39 #ifdef BOOST_HAS_RVALUE_REFS
40 #define BOOST_INTERPROCESS_PP_PARAM_LIST(z, n, data) \
41 BOOST_PP_CAT(P, n) && BOOST_PP_CAT(p, n) \
44 #define BOOST_INTERPROCESS_PP_PARAM_LIST(z, n, data) \
45 const BOOST_PP_CAT(P, n) & BOOST_PP_CAT(p, n) \
49 #ifdef BOOST_HAS_RVALUE_REFS
50 #define BOOST_INTERPROCESS_PARAM(U, u) \
54 #define BOOST_INTERPROCESS_PARAM(U, u) \
59 #ifdef BOOST_HAS_RVALUE_REFS
60 #define BOOST_INTERPROCESS_AUX_PARAM_INIT(z, n, data) \
61 BOOST_PP_CAT(m_p, n) (BOOST_PP_CAT(p, n)) \
64 #define BOOST_INTERPROCESS_AUX_PARAM_INIT(z, n, data) \
65 BOOST_PP_CAT(m_p, n) (const_cast<BOOST_PP_CAT(P, n) &>(BOOST_PP_CAT(p, n))) \
69 #define BOOST_INTERPROCESS_AUX_PARAM_INC(z, n, data) \
70 BOOST_PP_CAT(++m_p, n) \
73 #ifdef BOOST_HAS_RVALUE_REFS
74 #define BOOST_INTERPROCESS_AUX_PARAM_DEFINE(z, n, data) \
75 BOOST_PP_CAT(P, n) && BOOST_PP_CAT(m_p, n); \
78 #define BOOST_INTERPROCESS_AUX_PARAM_DEFINE(z, n, data) \
79 BOOST_PP_CAT(P, n) & BOOST_PP_CAT(m_p, n); \
83 #define BOOST_INTERPROCESS_PP_PARAM_FORWARD(z, n, data) \
84 boost::interprocess::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(p, n) ) \
87 #define BOOST_INTERPROCESS_PP_MEMBER_FORWARD(z, n, data) \
88 boost::interprocess::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(m_p, n) ) \
91 #define BOOST_INTERPROCESS_PP_MEMBER_IT_FORWARD(z, n, data) \
92 BOOST_PP_CAT(*m_p, n) \
95 #include <boost/interprocess/detail/config_end.hpp>
98 #ifdef BOOST_INTERPROCESS_PERFECT_FORWARDING
99 #error "This file is not needed when perfect forwarding is available"
101 #endif //#ifndef BOOST_INTERPROCESS_DETAIL_PREPROCESSOR_HPP