pp_perfect_fwd.hpp 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. /* Copyright 2006-2014 Joaquin M Lopez Munoz.
  2. * Distributed under the Boost Software License, Version 1.0.
  3. * (See accompanying file LICENSE_1_0.txt or copy at
  4. * http://www.boost.org/LICENSE_1_0.txt)
  5. *
  6. * See http://www.boost.org/libs/flyweight for library home page.
  7. */
  8. #ifndef BOOST_FLYWEIGHT_DETAIL_PP_PERFECT_FWD_HPP
  9. #define BOOST_FLYWEIGHT_DETAIL_PP_PERFECT_FWD_HPP
  10. #if defined(_MSC_VER)
  11. #pragma once
  12. #endif
  13. #include <boost/config.hpp>
  14. #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
  15. #define BOOST_FLYWEIGHT_PERFECT_FWD_0(name,body) \
  16. name()body((FORWARD)(0))
  17. #if BOOST_FLYWEIGHT_LIMIT_PERFECT_FWD_ARGS>=1
  18. #define BOOST_FLYWEIGHT_PERFECT_FWD_1(name,body) \
  19. template<typename T0> name(T0&& t0)body((FORWARD)(1))
  20. #endif
  21. #if BOOST_FLYWEIGHT_LIMIT_PERFECT_FWD_ARGS>=2
  22. #define BOOST_FLYWEIGHT_PERFECT_FWD_2(name,body) \
  23. template<typename T0,typename T1> name(T0&& t0,T1&& t1)body((FORWARD)(2))
  24. #endif
  25. #if BOOST_FLYWEIGHT_LIMIT_PERFECT_FWD_ARGS>=3
  26. #define BOOST_FLYWEIGHT_PERFECT_FWD_3(name,body) \
  27. template<typename T0,typename T1,typename T2> name(T0&& t0,T1&& t1,T2&& t2)body((FORWARD)(3))
  28. #endif
  29. #if BOOST_FLYWEIGHT_LIMIT_PERFECT_FWD_ARGS>=4
  30. #define BOOST_FLYWEIGHT_PERFECT_FWD_4(name,body) \
  31. template<typename T0,typename T1,typename T2,typename T3> name(T0&& t0,T1&& t1,T2&& t2,T3&& t3)body((FORWARD)(4))
  32. #endif
  33. #if BOOST_FLYWEIGHT_LIMIT_PERFECT_FWD_ARGS>=5
  34. #define BOOST_FLYWEIGHT_PERFECT_FWD_5(name,body) \
  35. template<typename T0,typename T1,typename T2,typename T3,typename T4> name(T0&& t0,T1&& t1,T2&& t2,T3&& t3,T4&& t4)body((FORWARD)(5))
  36. #endif
  37. #else
  38. /* no rvalue refs -> [const] Tn& overloads */
  39. #define BOOST_FLYWEIGHT_PERFECT_FWD_0(name,body) \
  40. name()body((ENUM)(0))
  41. #if BOOST_FLYWEIGHT_LIMIT_PERFECT_FWD_ARGS>=1
  42. #define BOOST_FLYWEIGHT_PERFECT_FWD_1(name,body) \
  43. template<typename T0> name(T0& t0)body((ENUM)(1))\
  44. template<typename T0> name(const T0& t0)body((ENUM)(1))
  45. #endif
  46. #if BOOST_FLYWEIGHT_LIMIT_PERFECT_FWD_ARGS>=2
  47. #define BOOST_FLYWEIGHT_PERFECT_FWD_2(name,body) \
  48. template<typename T0,typename T1> name(T0& t0,T1& t1)body((ENUM)(2))\
  49. template<typename T0,typename T1> name(T0& t0,const T1& t1)body((ENUM)(2))\
  50. template<typename T0,typename T1> name(const T0& t0,T1& t1)body((ENUM)(2))\
  51. template<typename T0,typename T1> name(const T0& t0,const T1& t1)body((ENUM)(2))
  52. #endif
  53. #if BOOST_FLYWEIGHT_LIMIT_PERFECT_FWD_ARGS>=3
  54. #define BOOST_FLYWEIGHT_PERFECT_FWD_3(name,body) \
  55. template<typename T0,typename T1,typename T2> name(T0& t0,T1& t1,T2& t2)body((ENUM)(3))\
  56. template<typename T0,typename T1,typename T2> name(T0& t0,T1& t1,const T2& t2)body((ENUM)(3))\
  57. template<typename T0,typename T1,typename T2> name(T0& t0,const T1& t1,T2& t2)body((ENUM)(3))\
  58. template<typename T0,typename T1,typename T2> name(T0& t0,const T1& t1,const T2& t2)body((ENUM)(3))\
  59. template<typename T0,typename T1,typename T2> name(const T0& t0,T1& t1,T2& t2)body((ENUM)(3))\
  60. template<typename T0,typename T1,typename T2> name(const T0& t0,T1& t1,const T2& t2)body((ENUM)(3))\
  61. template<typename T0,typename T1,typename T2> name(const T0& t0,const T1& t1,T2& t2)body((ENUM)(3))\
  62. template<typename T0,typename T1,typename T2> name(const T0& t0,const T1& t1,const T2& t2)body((ENUM)(3))
  63. #endif
  64. #if BOOST_FLYWEIGHT_LIMIT_PERFECT_FWD_ARGS>=4
  65. #define BOOST_FLYWEIGHT_PERFECT_FWD_4(name,body) \
  66. template<typename T0,typename T1,typename T2,typename T3> name(T0& t0,T1& t1,T2& t2,T3& t3)body((ENUM)(4))\
  67. template<typename T0,typename T1,typename T2,typename T3> name(T0& t0,T1& t1,T2& t2,const T3& t3)body((ENUM)(4))\
  68. template<typename T0,typename T1,typename T2,typename T3> name(T0& t0,T1& t1,const T2& t2,T3& t3)body((ENUM)(4))\
  69. template<typename T0,typename T1,typename T2,typename T3> name(T0& t0,T1& t1,const T2& t2,const T3& t3)body((ENUM)(4))\
  70. template<typename T0,typename T1,typename T2,typename T3> name(T0& t0,const T1& t1,T2& t2,T3& t3)body((ENUM)(4))\
  71. template<typename T0,typename T1,typename T2,typename T3> name(T0& t0,const T1& t1,T2& t2,const T3& t3)body((ENUM)(4))\
  72. template<typename T0,typename T1,typename T2,typename T3> name(T0& t0,const T1& t1,const T2& t2,T3& t3)body((ENUM)(4))\
  73. template<typename T0,typename T1,typename T2,typename T3> name(T0& t0,const T1& t1,const T2& t2,const T3& t3)body((ENUM)(4))\
  74. template<typename T0,typename T1,typename T2,typename T3> name(const T0& t0,T1& t1,T2& t2,T3& t3)body((ENUM)(4))\
  75. template<typename T0,typename T1,typename T2,typename T3> name(const T0& t0,T1& t1,T2& t2,const T3& t3)body((ENUM)(4))\
  76. template<typename T0,typename T1,typename T2,typename T3> name(const T0& t0,T1& t1,const T2& t2,T3& t3)body((ENUM)(4))\
  77. template<typename T0,typename T1,typename T2,typename T3> name(const T0& t0,T1& t1,const T2& t2,const T3& t3)body((ENUM)(4))\
  78. template<typename T0,typename T1,typename T2,typename T3> name(const T0& t0,const T1& t1,T2& t2,T3& t3)body((ENUM)(4))\
  79. template<typename T0,typename T1,typename T2,typename T3> name(const T0& t0,const T1& t1,T2& t2,const T3& t3)body((ENUM)(4))\
  80. template<typename T0,typename T1,typename T2,typename T3> name(const T0& t0,const T1& t1,const T2& t2,T3& t3)body((ENUM)(4))\
  81. template<typename T0,typename T1,typename T2,typename T3> name(const T0& t0,const T1& t1,const T2& t2,const T3& t3)body((ENUM)(4))
  82. #endif
  83. #if BOOST_FLYWEIGHT_LIMIT_PERFECT_FWD_ARGS>=5
  84. #define BOOST_FLYWEIGHT_PERFECT_FWD_5(name,body) \
  85. template<typename T0,typename T1,typename T2,typename T3,typename T4> name(T0& t0,T1& t1,T2& t2,T3& t3,T4& t4)body((ENUM)(5))\
  86. template<typename T0,typename T1,typename T2,typename T3,typename T4> name(T0& t0,T1& t1,T2& t2,T3& t3,const T4& t4)body((ENUM)(5))\
  87. template<typename T0,typename T1,typename T2,typename T3,typename T4> name(T0& t0,T1& t1,T2& t2,const T3& t3,T4& t4)body((ENUM)(5))\
  88. template<typename T0,typename T1,typename T2,typename T3,typename T4> name(T0& t0,T1& t1,T2& t2,const T3& t3,const T4& t4)body((ENUM)(5))\
  89. template<typename T0,typename T1,typename T2,typename T3,typename T4> name(T0& t0,T1& t1,const T2& t2,T3& t3,T4& t4)body((ENUM)(5))\
  90. template<typename T0,typename T1,typename T2,typename T3,typename T4> name(T0& t0,T1& t1,const T2& t2,T3& t3,const T4& t4)body((ENUM)(5))\
  91. template<typename T0,typename T1,typename T2,typename T3,typename T4> name(T0& t0,T1& t1,const T2& t2,const T3& t3,T4& t4)body((ENUM)(5))\
  92. template<typename T0,typename T1,typename T2,typename T3,typename T4> name(T0& t0,T1& t1,const T2& t2,const T3& t3,const T4& t4)body((ENUM)(5))\
  93. template<typename T0,typename T1,typename T2,typename T3,typename T4> name(T0& t0,const T1& t1,T2& t2,T3& t3,T4& t4)body((ENUM)(5))\
  94. template<typename T0,typename T1,typename T2,typename T3,typename T4> name(T0& t0,const T1& t1,T2& t2,T3& t3,const T4& t4)body((ENUM)(5))\
  95. template<typename T0,typename T1,typename T2,typename T3,typename T4> name(T0& t0,const T1& t1,T2& t2,const T3& t3,T4& t4)body((ENUM)(5))\
  96. template<typename T0,typename T1,typename T2,typename T3,typename T4> name(T0& t0,const T1& t1,T2& t2,const T3& t3,const T4& t4)body((ENUM)(5))\
  97. template<typename T0,typename T1,typename T2,typename T3,typename T4> name(T0& t0,const T1& t1,const T2& t2,T3& t3,T4& t4)body((ENUM)(5))\
  98. template<typename T0,typename T1,typename T2,typename T3,typename T4> name(T0& t0,const T1& t1,const T2& t2,T3& t3,const T4& t4)body((ENUM)(5))\
  99. template<typename T0,typename T1,typename T2,typename T3,typename T4> name(T0& t0,const T1& t1,const T2& t2,const T3& t3,T4& t4)body((ENUM)(5))\
  100. template<typename T0,typename T1,typename T2,typename T3,typename T4> name(T0& t0,const T1& t1,const T2& t2,const T3& t3,const T4& t4)body((ENUM)(5))\
  101. template<typename T0,typename T1,typename T2,typename T3,typename T4> name(const T0& t0,T1& t1,T2& t2,T3& t3,T4& t4)body((ENUM)(5))\
  102. template<typename T0,typename T1,typename T2,typename T3,typename T4> name(const T0& t0,T1& t1,T2& t2,T3& t3,const T4& t4)body((ENUM)(5))\
  103. template<typename T0,typename T1,typename T2,typename T3,typename T4> name(const T0& t0,T1& t1,T2& t2,const T3& t3,T4& t4)body((ENUM)(5))\
  104. template<typename T0,typename T1,typename T2,typename T3,typename T4> name(const T0& t0,T1& t1,T2& t2,const T3& t3,const T4& t4)body((ENUM)(5))\
  105. template<typename T0,typename T1,typename T2,typename T3,typename T4> name(const T0& t0,T1& t1,const T2& t2,T3& t3,T4& t4)body((ENUM)(5))\
  106. template<typename T0,typename T1,typename T2,typename T3,typename T4> name(const T0& t0,T1& t1,const T2& t2,T3& t3,const T4& t4)body((ENUM)(5))\
  107. template<typename T0,typename T1,typename T2,typename T3,typename T4> name(const T0& t0,T1& t1,const T2& t2,const T3& t3,T4& t4)body((ENUM)(5))\
  108. template<typename T0,typename T1,typename T2,typename T3,typename T4> name(const T0& t0,T1& t1,const T2& t2,const T3& t3,const T4& t4)body((ENUM)(5))\
  109. template<typename T0,typename T1,typename T2,typename T3,typename T4> name(const T0& t0,const T1& t1,T2& t2,T3& t3,T4& t4)body((ENUM)(5))\
  110. template<typename T0,typename T1,typename T2,typename T3,typename T4> name(const T0& t0,const T1& t1,T2& t2,T3& t3,const T4& t4)body((ENUM)(5))\
  111. template<typename T0,typename T1,typename T2,typename T3,typename T4> name(const T0& t0,const T1& t1,T2& t2,const T3& t3,T4& t4)body((ENUM)(5))\
  112. template<typename T0,typename T1,typename T2,typename T3,typename T4> name(const T0& t0,const T1& t1,T2& t2,const T3& t3,const T4& t4)body((ENUM)(5))\
  113. template<typename T0,typename T1,typename T2,typename T3,typename T4> name(const T0& t0,const T1& t1,const T2& t2,T3& t3,T4& t4)body((ENUM)(5))\
  114. template<typename T0,typename T1,typename T2,typename T3,typename T4> name(const T0& t0,const T1& t1,const T2& t2,T3& t3,const T4& t4)body((ENUM)(5))\
  115. template<typename T0,typename T1,typename T2,typename T3,typename T4> name(const T0& t0,const T1& t1,const T2& t2,const T3& t3,T4& t4)body((ENUM)(5))\
  116. template<typename T0,typename T1,typename T2,typename T3,typename T4> name(const T0& t0,const T1& t1,const T2& t2,const T3& t3,const T4& t4)body((ENUM)(5))
  117. #endif
  118. #endif
  119. #if BOOST_FLYWEIGHT_LIMIT_PERFECT_FWD_ARGS==0
  120. #define BOOST_FLYWEIGHT_PERFECT_FWD_WITH_ARGS(name,body)
  121. #elif BOOST_FLYWEIGHT_LIMIT_PERFECT_FWD_ARGS==1
  122. #define BOOST_FLYWEIGHT_PERFECT_FWD_WITH_ARGS(name,body) \
  123. BOOST_FLYWEIGHT_PERFECT_FWD_1(name,body)
  124. #elif BOOST_FLYWEIGHT_LIMIT_PERFECT_FWD_ARGS==2
  125. #define BOOST_FLYWEIGHT_PERFECT_FWD_WITH_ARGS(name,body) \
  126. BOOST_FLYWEIGHT_PERFECT_FWD_1(name,body) \
  127. BOOST_FLYWEIGHT_PERFECT_FWD_2(name,body)
  128. #elif BOOST_FLYWEIGHT_LIMIT_PERFECT_FWD_ARGS==3
  129. #define BOOST_FLYWEIGHT_PERFECT_FWD_WITH_ARGS(name,body) \
  130. BOOST_FLYWEIGHT_PERFECT_FWD_1(name,body) \
  131. BOOST_FLYWEIGHT_PERFECT_FWD_2(name,body) \
  132. BOOST_FLYWEIGHT_PERFECT_FWD_3(name,body)
  133. #elif BOOST_FLYWEIGHT_LIMIT_PERFECT_FWD_ARGS==4
  134. #define BOOST_FLYWEIGHT_PERFECT_FWD_WITH_ARGS(name,body) \
  135. BOOST_FLYWEIGHT_PERFECT_FWD_1(name,body) \
  136. BOOST_FLYWEIGHT_PERFECT_FWD_2(name,body) \
  137. BOOST_FLYWEIGHT_PERFECT_FWD_3(name,body) \
  138. BOOST_FLYWEIGHT_PERFECT_FWD_4(name,body)
  139. #else /* BOOST_FLYWEIGHT_LIMIT_PERFECT_FWD_ARGS==5 */
  140. #define BOOST_FLYWEIGHT_PERFECT_FWD_WITH_ARGS(name,body) \
  141. BOOST_FLYWEIGHT_PERFECT_FWD_1(name,body) \
  142. BOOST_FLYWEIGHT_PERFECT_FWD_2(name,body) \
  143. BOOST_FLYWEIGHT_PERFECT_FWD_3(name,body) \
  144. BOOST_FLYWEIGHT_PERFECT_FWD_4(name,body) \
  145. BOOST_FLYWEIGHT_PERFECT_FWD_5(name,body)
  146. #endif
  147. #define BOOST_FLYWEIGHT_PERFECT_FWD(name,body) \
  148. BOOST_FLYWEIGHT_PERFECT_FWD_0(name,body) \
  149. BOOST_FLYWEIGHT_PERFECT_FWD_WITH_ARGS(name,body)
  150. #endif