fix doc example typo
[boost.git] / boost / interprocess / detail / preprocessor.hpp
blobb7cb8fd328ea9d4cf3e8076d2fc127670da01e8c
1 //////////////////////////////////////////////////////////////////////////////
2 //
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)
6 //
7 // See http://www.boost.org/libs/interprocess for documentation.
8 //
9 //////////////////////////////////////////////////////////////////////////////
11 #ifndef BOOST_INTERPROCESS_DETAIL_PREPROCESSOR_HPP
12 #define BOOST_INTERPROCESS_DETAIL_PREPROCESSOR_HPP
14 #if (defined _MSC_VER) && (_MSC_VER >= 1200)
15 # pragma once
16 #endif
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"
23 #endif
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
33 //Note:
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) \
42 //!
43 #else
44 #define BOOST_INTERPROCESS_PP_PARAM_LIST(z, n, data) \
45 const BOOST_PP_CAT(P, n) & BOOST_PP_CAT(p, n) \
46 //!
47 #endif
49 #ifdef BOOST_HAS_RVALUE_REFS
50 #define BOOST_INTERPROCESS_PARAM(U, u) \
51 U && u \
52 //!
53 #else
54 #define BOOST_INTERPROCESS_PARAM(U, u) \
55 const U & u \
56 //!
57 #endif
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)) \
62 //!
63 #else
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))) \
66 //!
67 #endif
69 #define BOOST_INTERPROCESS_AUX_PARAM_INC(z, n, data) \
70 BOOST_PP_CAT(++m_p, n) \
71 //!
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); \
76 //!
77 #else
78 #define BOOST_INTERPROCESS_AUX_PARAM_DEFINE(z, n, data) \
79 BOOST_PP_CAT(P, n) & BOOST_PP_CAT(m_p, n); \
80 //!
81 #endif
83 #define BOOST_INTERPROCESS_PP_PARAM_FORWARD(z, n, data) \
84 boost::interprocess::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(p, n) ) \
85 //!
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) ) \
89 //!
91 #define BOOST_INTERPROCESS_PP_MEMBER_IT_FORWARD(z, n, data) \
92 BOOST_PP_CAT(*m_p, n) \
93 //!
95 #include <boost/interprocess/detail/config_end.hpp>
97 #else
98 #ifdef BOOST_INTERPROCESS_PERFECT_FORWARDING
99 #error "This file is not needed when perfect forwarding is available"
100 #endif
101 #endif //#ifndef BOOST_INTERPROCESS_DETAIL_PREPROCESSOR_HPP