]> git.sesse.net Git - casparcg/blob - dependencies/boost/boost/interprocess/detail/preprocessor.hpp
Manually merged pull request #222
[casparcg] / dependencies / boost / boost / interprocess / detail / preprocessor.hpp
1 //////////////////////////////////////////////////////////////////////////////
2 //
3 // (C) Copyright Ion Gaztanaga 2008-2009. 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 //////////////////////////////////////////////////////////////////////////////
10
11 #ifndef BOOST_INTERPROCESS_DETAIL_PREPROCESSOR_HPP
12 #define BOOST_INTERPROCESS_DETAIL_PREPROCESSOR_HPP
13
14 #if (defined _MSC_VER) && (_MSC_VER >= 1200)
15 #  pragma once
16 #endif
17
18 #include "config_begin.hpp"
19
20 #ifdef BOOST_INTERPROCESS_PERFECT_FORWARDING
21 #error "This file is not needed when perfect forwarding is available"
22 #endif
23
24 #include <boost/preprocessor/iteration/local.hpp> 
25 #include <boost/preprocessor/repetition/enum_params.hpp>
26 #include <boost/preprocessor/cat.hpp>
27 #include <boost/preprocessor/repetition/enum.hpp>
28 #include <boost/preprocessor/repetition/repeat.hpp>
29
30 #define BOOST_INTERPROCESS_MAX_CONSTRUCTOR_PARAMETERS 10
31
32 //Note:
33 //We define template parameters as const references to
34 //be able to bind temporaries. After that we will un-const them.
35 //This cast is ugly but it is necessary until "perfect forwarding"
36 //is achieved in C++0x. Meanwhile, if we want to be able to
37 //bind rvalues with non-const references, we have to be ugly
38 #ifndef BOOST_NO_RVALUE_REFERENCES
39    #define BOOST_INTERPROCESS_PP_PARAM_LIST(z, n, data) \
40    BOOST_PP_CAT(P, n) && BOOST_PP_CAT(p, n) \
41    //!
42 #else
43    #define BOOST_INTERPROCESS_PP_PARAM_LIST(z, n, data) \
44    const BOOST_PP_CAT(P, n) & BOOST_PP_CAT(p, n) \
45    //!
46 #endif
47
48 #ifndef BOOST_NO_RVALUE_REFERENCES
49    #define BOOST_INTERPROCESS_PARAM(U, u) \
50    U && u \
51    //!
52 #else
53    #define BOOST_INTERPROCESS_PARAM(U, u) \
54    const U & u \
55    //!
56 #endif
57
58 #ifndef BOOST_NO_RVALUE_REFERENCES
59
60 #ifdef BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES
61
62 #define BOOST_INTERPROCESS_AUX_PARAM_INIT(z, n, data) \
63   BOOST_PP_CAT(m_p, n) (BOOST_INTERPROCESS_MOVE_NAMESPACE::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(p, n) ))           \
64 //!
65
66 #else
67
68 #define BOOST_INTERPROCESS_AUX_PARAM_INIT(z, n, data) \
69   BOOST_PP_CAT(m_p, n) (BOOST_PP_CAT(p, n))           \
70 //!
71
72 #endif
73
74 #else
75 #define BOOST_INTERPROCESS_AUX_PARAM_INIT(z, n, data) \
76   BOOST_PP_CAT(m_p, n) (const_cast<BOOST_PP_CAT(P, n) &>(BOOST_PP_CAT(p, n))) \
77 //!
78 #endif
79
80 #define BOOST_INTERPROCESS_AUX_PARAM_INC(z, n, data)   \
81   BOOST_PP_CAT(++m_p, n)                        \
82 //!
83
84 #ifndef BOOST_NO_RVALUE_REFERENCES
85
86 #if defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG)
87
88 #define BOOST_INTERPROCESS_AUX_PARAM_DEFINE(z, n, data)  \
89   BOOST_PP_CAT(P, n) & BOOST_PP_CAT(m_p, n);            \
90 //!
91
92 #else
93
94 #define BOOST_INTERPROCESS_AUX_PARAM_DEFINE(z, n, data)  \
95   BOOST_PP_CAT(P, n) && BOOST_PP_CAT(m_p, n);            \
96 //!
97
98 #endif //defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG)
99
100
101 #else
102 #define BOOST_INTERPROCESS_AUX_PARAM_DEFINE(z, n, data)  \
103   BOOST_PP_CAT(P, n) & BOOST_PP_CAT(m_p, n);             \
104 //!
105 #endif
106
107 #define BOOST_INTERPROCESS_PP_PARAM_FORWARD(z, n, data) \
108 ::boost::interprocess::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(p, n) ) \
109 //!
110
111 #if !defined(BOOST_NO_RVALUE_REFERENCES) && defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG)
112
113 #include <boost/container/detail/stored_ref.hpp>
114
115 #define BOOST_INTERPROCESS_PP_MEMBER_FORWARD(z, n, data) \
116 ::boost::container::containers_detail::stored_ref< BOOST_PP_CAT(P, n) >::forward( BOOST_PP_CAT(m_p, n) ) \
117 //!
118
119 #else
120
121 #define BOOST_INTERPROCESS_PP_MEMBER_FORWARD(z, n, data) \
122 ::boost::interprocess::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(m_p, n) ) \
123 //!
124
125 #endif   //!defined(BOOST_NO_RVALUE_REFERENCES) && defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG)
126
127 #define BOOST_INTERPROCESS_PP_MEMBER_IT_FORWARD(z, n, data) \
128 BOOST_PP_CAT(*m_p, n) \
129 //!
130
131 #include <boost/interprocess/detail/config_end.hpp>
132
133 #else
134 #ifdef BOOST_INTERPROCESS_PERFECT_FORWARDING
135 #error "This file is not needed when perfect forwarding is available"
136 #endif
137 #endif //#ifndef BOOST_INTERPROCESS_DETAIL_PREPROCESSOR_HPP