/Src/Dependencies/Boost/boost/interprocess/detail/preprocessor.hpp

http://hadesmem.googlecode.com/ · C++ Header · 137 lines · 73 code · 34 blank · 30 comment · 5 complexity · e933bda1c1c86394020c20addd641a6b MD5 · raw file

  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. #ifndef BOOST_INTERPROCESS_DETAIL_PREPROCESSOR_HPP
  11. #define BOOST_INTERPROCESS_DETAIL_PREPROCESSOR_HPP
  12. #if (defined _MSC_VER) && (_MSC_VER >= 1200)
  13. # pragma once
  14. #endif
  15. #include "config_begin.hpp"
  16. #ifdef BOOST_INTERPROCESS_PERFECT_FORWARDING
  17. #error "This file is not needed when perfect forwarding is available"
  18. #endif
  19. #include <boost/preprocessor/iteration/local.hpp>
  20. #include <boost/preprocessor/repetition/enum_params.hpp>
  21. #include <boost/preprocessor/cat.hpp>
  22. #include <boost/preprocessor/repetition/enum.hpp>
  23. #include <boost/preprocessor/repetition/repeat.hpp>
  24. #define BOOST_INTERPROCESS_MAX_CONSTRUCTOR_PARAMETERS 10
  25. //Note:
  26. //We define template parameters as const references to
  27. //be able to bind temporaries. After that we will un-const them.
  28. //This cast is ugly but it is necessary until "perfect forwarding"
  29. //is achieved in C++0x. Meanwhile, if we want to be able to
  30. //bind rvalues with non-const references, we have to be ugly
  31. #ifndef BOOST_NO_RVALUE_REFERENCES
  32. #define BOOST_INTERPROCESS_PP_PARAM_LIST(z, n, data) \
  33. BOOST_PP_CAT(P, n) && BOOST_PP_CAT(p, n) \
  34. //!
  35. #else
  36. #define BOOST_INTERPROCESS_PP_PARAM_LIST(z, n, data) \
  37. const BOOST_PP_CAT(P, n) & BOOST_PP_CAT(p, n) \
  38. //!
  39. #endif
  40. #ifndef BOOST_NO_RVALUE_REFERENCES
  41. #define BOOST_INTERPROCESS_PARAM(U, u) \
  42. U && u \
  43. //!
  44. #else
  45. #define BOOST_INTERPROCESS_PARAM(U, u) \
  46. const U & u \
  47. //!
  48. #endif
  49. #ifndef BOOST_NO_RVALUE_REFERENCES
  50. #ifdef BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES
  51. #define BOOST_INTERPROCESS_AUX_PARAM_INIT(z, n, data) \
  52. BOOST_PP_CAT(m_p, n) (BOOST_INTERPROCESS_MOVE_NAMESPACE::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(p, n) )) \
  53. //!
  54. #else
  55. #define BOOST_INTERPROCESS_AUX_PARAM_INIT(z, n, data) \
  56. BOOST_PP_CAT(m_p, n) (BOOST_PP_CAT(p, n)) \
  57. //!
  58. #endif
  59. #else
  60. #define BOOST_INTERPROCESS_AUX_PARAM_INIT(z, n, data) \
  61. BOOST_PP_CAT(m_p, n) (const_cast<BOOST_PP_CAT(P, n) &>(BOOST_PP_CAT(p, n))) \
  62. //!
  63. #endif
  64. #define BOOST_INTERPROCESS_AUX_PARAM_INC(z, n, data) \
  65. BOOST_PP_CAT(++m_p, n) \
  66. //!
  67. #ifndef BOOST_NO_RVALUE_REFERENCES
  68. #if defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG)
  69. #define BOOST_INTERPROCESS_AUX_PARAM_DEFINE(z, n, data) \
  70. BOOST_PP_CAT(P, n) & BOOST_PP_CAT(m_p, n); \
  71. //!
  72. #else
  73. #define BOOST_INTERPROCESS_AUX_PARAM_DEFINE(z, n, data) \
  74. BOOST_PP_CAT(P, n) && BOOST_PP_CAT(m_p, n); \
  75. //!
  76. #endif //defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG)
  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
  82. #define BOOST_INTERPROCESS_PP_PARAM_FORWARD(z, n, data) \
  83. ::boost::interprocess::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(p, n) ) \
  84. //!
  85. #if !defined(BOOST_NO_RVALUE_REFERENCES) && defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG)
  86. #include <boost/interprocess/containers/container/detail/stored_ref.hpp>
  87. #define BOOST_INTERPROCESS_PP_MEMBER_FORWARD(z, n, data) \
  88. ::boost::container::containers_detail::stored_ref< BOOST_PP_CAT(P, n) >::forward( BOOST_PP_CAT(m_p, n) ) \
  89. //!
  90. #else
  91. #define BOOST_INTERPROCESS_PP_MEMBER_FORWARD(z, n, data) \
  92. ::boost::interprocess::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(m_p, n) ) \
  93. //!
  94. #endif //!defined(BOOST_NO_RVALUE_REFERENCES) && defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG)
  95. #define BOOST_INTERPROCESS_PP_MEMBER_IT_FORWARD(z, n, data) \
  96. BOOST_PP_CAT(*m_p, n) \
  97. //!
  98. #include <boost/interprocess/detail/config_end.hpp>
  99. #else
  100. #ifdef BOOST_INTERPROCESS_PERFECT_FORWARDING
  101. #error "This file is not needed when perfect forwarding is available"
  102. #endif
  103. #endif //#ifndef BOOST_INTERPROCESS_DETAIL_PREPROCESSOR_HPP