shared.hpp 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. # /* **************************************************************************
  2. # * *
  3. # * (C) Copyright Paul Mensonides 2002.
  4. # * Distributed under the Boost Software License, Version 1.0. (See
  5. # * accompanying file LICENSE_1_0.txt or copy at
  6. # * http://www.boost.org/LICENSE_1_0.txt)
  7. # * *
  8. # ************************************************************************** */
  9. #
  10. # /* See http://www.boost.org for most recent version. */
  11. #
  12. # ifndef BOOST_PP_VALUE
  13. # error BOOST_PP_ERROR: BOOST_PP_VALUE is not defined
  14. # endif
  15. #
  16. # undef BOOST_PP_SLOT_TEMP_1
  17. # undef BOOST_PP_SLOT_TEMP_2
  18. # undef BOOST_PP_SLOT_TEMP_3
  19. # undef BOOST_PP_SLOT_TEMP_4
  20. # undef BOOST_PP_SLOT_TEMP_5
  21. # undef BOOST_PP_SLOT_TEMP_6
  22. # undef BOOST_PP_SLOT_TEMP_7
  23. # undef BOOST_PP_SLOT_TEMP_8
  24. # undef BOOST_PP_SLOT_TEMP_9
  25. # undef BOOST_PP_SLOT_TEMP_10
  26. #
  27. # if (BOOST_PP_VALUE) / 1000000000UL == 0
  28. # define BOOST_PP_SLOT_TEMP_10 0
  29. # elif (BOOST_PP_VALUE) / 1000000000UL == 1
  30. # define BOOST_PP_SLOT_TEMP_10 1
  31. # elif (BOOST_PP_VALUE) / 1000000000UL == 2
  32. # define BOOST_PP_SLOT_TEMP_10 2
  33. # elif (BOOST_PP_VALUE) / 1000000000UL == 3
  34. # define BOOST_PP_SLOT_TEMP_10 3
  35. # elif (BOOST_PP_VALUE) / 1000000000UL == 4
  36. # define BOOST_PP_SLOT_TEMP_10 4
  37. # elif (BOOST_PP_VALUE) / 1000000000UL == 5
  38. # define BOOST_PP_SLOT_TEMP_10 5
  39. # elif (BOOST_PP_VALUE) / 1000000000UL == 6
  40. # define BOOST_PP_SLOT_TEMP_10 6
  41. # elif (BOOST_PP_VALUE) / 1000000000UL == 7
  42. # define BOOST_PP_SLOT_TEMP_10 7
  43. # elif (BOOST_PP_VALUE) / 1000000000UL == 8
  44. # define BOOST_PP_SLOT_TEMP_10 8
  45. # elif (BOOST_PP_VALUE) / 1000000000UL == 9
  46. # define BOOST_PP_SLOT_TEMP_10 9
  47. # endif
  48. #
  49. # if BOOST_PP_SLOT_OFFSET_10(BOOST_PP_VALUE) / 100000000UL == 0
  50. # define BOOST_PP_SLOT_TEMP_9 0
  51. # elif BOOST_PP_SLOT_OFFSET_10(BOOST_PP_VALUE) / 100000000UL == 1
  52. # define BOOST_PP_SLOT_TEMP_9 1
  53. # elif BOOST_PP_SLOT_OFFSET_10(BOOST_PP_VALUE) / 100000000UL == 2
  54. # define BOOST_PP_SLOT_TEMP_9 2
  55. # elif BOOST_PP_SLOT_OFFSET_10(BOOST_PP_VALUE) / 100000000UL == 3
  56. # define BOOST_PP_SLOT_TEMP_9 3
  57. # elif BOOST_PP_SLOT_OFFSET_10(BOOST_PP_VALUE) / 100000000UL == 4
  58. # define BOOST_PP_SLOT_TEMP_9 4
  59. # elif BOOST_PP_SLOT_OFFSET_10(BOOST_PP_VALUE) / 100000000UL == 5
  60. # define BOOST_PP_SLOT_TEMP_9 5
  61. # elif BOOST_PP_SLOT_OFFSET_10(BOOST_PP_VALUE) / 100000000UL == 6
  62. # define BOOST_PP_SLOT_TEMP_9 6
  63. # elif BOOST_PP_SLOT_OFFSET_10(BOOST_PP_VALUE) / 100000000UL == 7
  64. # define BOOST_PP_SLOT_TEMP_9 7
  65. # elif BOOST_PP_SLOT_OFFSET_10(BOOST_PP_VALUE) / 100000000UL == 8
  66. # define BOOST_PP_SLOT_TEMP_9 8
  67. # elif BOOST_PP_SLOT_OFFSET_10(BOOST_PP_VALUE) / 100000000UL == 9
  68. # define BOOST_PP_SLOT_TEMP_9 9
  69. # endif
  70. #
  71. # if BOOST_PP_SLOT_OFFSET_9(BOOST_PP_VALUE) / 10000000UL == 0
  72. # define BOOST_PP_SLOT_TEMP_8 0
  73. # elif BOOST_PP_SLOT_OFFSET_9(BOOST_PP_VALUE) / 10000000UL == 1
  74. # define BOOST_PP_SLOT_TEMP_8 1
  75. # elif BOOST_PP_SLOT_OFFSET_9(BOOST_PP_VALUE) / 10000000UL == 2
  76. # define BOOST_PP_SLOT_TEMP_8 2
  77. # elif BOOST_PP_SLOT_OFFSET_9(BOOST_PP_VALUE) / 10000000UL == 3
  78. # define BOOST_PP_SLOT_TEMP_8 3
  79. # elif BOOST_PP_SLOT_OFFSET_9(BOOST_PP_VALUE) / 10000000UL == 4
  80. # define BOOST_PP_SLOT_TEMP_8 4
  81. # elif BOOST_PP_SLOT_OFFSET_9(BOOST_PP_VALUE) / 10000000UL == 5
  82. # define BOOST_PP_SLOT_TEMP_8 5
  83. # elif BOOST_PP_SLOT_OFFSET_9(BOOST_PP_VALUE) / 10000000UL == 6
  84. # define BOOST_PP_SLOT_TEMP_8 6
  85. # elif BOOST_PP_SLOT_OFFSET_9(BOOST_PP_VALUE) / 10000000UL == 7
  86. # define BOOST_PP_SLOT_TEMP_8 7
  87. # elif BOOST_PP_SLOT_OFFSET_9(BOOST_PP_VALUE) / 10000000UL == 8
  88. # define BOOST_PP_SLOT_TEMP_8 8
  89. # elif BOOST_PP_SLOT_OFFSET_9(BOOST_PP_VALUE) / 10000000UL == 9
  90. # define BOOST_PP_SLOT_TEMP_8 9
  91. # endif
  92. #
  93. # if BOOST_PP_SLOT_OFFSET_8(BOOST_PP_VALUE) / 1000000UL == 0
  94. # define BOOST_PP_SLOT_TEMP_7 0
  95. # elif BOOST_PP_SLOT_OFFSET_8(BOOST_PP_VALUE) / 1000000UL == 1
  96. # define BOOST_PP_SLOT_TEMP_7 1
  97. # elif BOOST_PP_SLOT_OFFSET_8(BOOST_PP_VALUE) / 1000000UL == 2
  98. # define BOOST_PP_SLOT_TEMP_7 2
  99. # elif BOOST_PP_SLOT_OFFSET_8(BOOST_PP_VALUE) / 1000000UL == 3
  100. # define BOOST_PP_SLOT_TEMP_7 3
  101. # elif BOOST_PP_SLOT_OFFSET_8(BOOST_PP_VALUE) / 1000000UL == 4
  102. # define BOOST_PP_SLOT_TEMP_7 4
  103. # elif BOOST_PP_SLOT_OFFSET_8(BOOST_PP_VALUE) / 1000000UL == 5
  104. # define BOOST_PP_SLOT_TEMP_7 5
  105. # elif BOOST_PP_SLOT_OFFSET_8(BOOST_PP_VALUE) / 1000000UL == 6
  106. # define BOOST_PP_SLOT_TEMP_7 6
  107. # elif BOOST_PP_SLOT_OFFSET_8(BOOST_PP_VALUE) / 1000000UL == 7
  108. # define BOOST_PP_SLOT_TEMP_7 7
  109. # elif BOOST_PP_SLOT_OFFSET_8(BOOST_PP_VALUE) / 1000000UL == 8
  110. # define BOOST_PP_SLOT_TEMP_7 8
  111. # elif BOOST_PP_SLOT_OFFSET_8(BOOST_PP_VALUE) / 1000000UL == 9
  112. # define BOOST_PP_SLOT_TEMP_7 9
  113. # endif
  114. #
  115. # if BOOST_PP_SLOT_OFFSET_7(BOOST_PP_VALUE) / 100000UL == 0
  116. # define BOOST_PP_SLOT_TEMP_6 0
  117. # elif BOOST_PP_SLOT_OFFSET_7(BOOST_PP_VALUE) / 100000UL == 1
  118. # define BOOST_PP_SLOT_TEMP_6 1
  119. # elif BOOST_PP_SLOT_OFFSET_7(BOOST_PP_VALUE) / 100000UL == 2
  120. # define BOOST_PP_SLOT_TEMP_6 2
  121. # elif BOOST_PP_SLOT_OFFSET_7(BOOST_PP_VALUE) / 100000UL == 3
  122. # define BOOST_PP_SLOT_TEMP_6 3
  123. # elif BOOST_PP_SLOT_OFFSET_7(BOOST_PP_VALUE) / 100000UL == 4
  124. # define BOOST_PP_SLOT_TEMP_6 4
  125. # elif BOOST_PP_SLOT_OFFSET_7(BOOST_PP_VALUE) / 100000UL == 5
  126. # define BOOST_PP_SLOT_TEMP_6 5
  127. # elif BOOST_PP_SLOT_OFFSET_7(BOOST_PP_VALUE) / 100000UL == 6
  128. # define BOOST_PP_SLOT_TEMP_6 6
  129. # elif BOOST_PP_SLOT_OFFSET_7(BOOST_PP_VALUE) / 100000UL == 7
  130. # define BOOST_PP_SLOT_TEMP_6 7
  131. # elif BOOST_PP_SLOT_OFFSET_7(BOOST_PP_VALUE) / 100000UL == 8
  132. # define BOOST_PP_SLOT_TEMP_6 8
  133. # elif BOOST_PP_SLOT_OFFSET_7(BOOST_PP_VALUE) / 100000UL == 9
  134. # define BOOST_PP_SLOT_TEMP_6 9
  135. # endif
  136. #
  137. # if BOOST_PP_SLOT_OFFSET_6(BOOST_PP_VALUE) / 10000UL == 0
  138. # define BOOST_PP_SLOT_TEMP_5 0
  139. # elif BOOST_PP_SLOT_OFFSET_6(BOOST_PP_VALUE) / 10000UL == 1
  140. # define BOOST_PP_SLOT_TEMP_5 1
  141. # elif BOOST_PP_SLOT_OFFSET_6(BOOST_PP_VALUE) / 10000UL == 2
  142. # define BOOST_PP_SLOT_TEMP_5 2
  143. # elif BOOST_PP_SLOT_OFFSET_6(BOOST_PP_VALUE) / 10000UL == 3
  144. # define BOOST_PP_SLOT_TEMP_5 3
  145. # elif BOOST_PP_SLOT_OFFSET_6(BOOST_PP_VALUE) / 10000UL == 4
  146. # define BOOST_PP_SLOT_TEMP_5 4
  147. # elif BOOST_PP_SLOT_OFFSET_6(BOOST_PP_VALUE) / 10000UL == 5
  148. # define BOOST_PP_SLOT_TEMP_5 5
  149. # elif BOOST_PP_SLOT_OFFSET_6(BOOST_PP_VALUE) / 10000UL == 6
  150. # define BOOST_PP_SLOT_TEMP_5 6
  151. # elif BOOST_PP_SLOT_OFFSET_6(BOOST_PP_VALUE) / 10000UL == 7
  152. # define BOOST_PP_SLOT_TEMP_5 7
  153. # elif BOOST_PP_SLOT_OFFSET_6(BOOST_PP_VALUE) / 10000UL == 8
  154. # define BOOST_PP_SLOT_TEMP_5 8
  155. # elif BOOST_PP_SLOT_OFFSET_6(BOOST_PP_VALUE) / 10000UL == 9
  156. # define BOOST_PP_SLOT_TEMP_5 9
  157. # endif
  158. #
  159. # if BOOST_PP_SLOT_OFFSET_5(BOOST_PP_VALUE) / 1000UL == 0
  160. # define BOOST_PP_SLOT_TEMP_4 0
  161. # elif BOOST_PP_SLOT_OFFSET_5(BOOST_PP_VALUE) / 1000UL == 1
  162. # define BOOST_PP_SLOT_TEMP_4 1
  163. # elif BOOST_PP_SLOT_OFFSET_5(BOOST_PP_VALUE) / 1000UL == 2
  164. # define BOOST_PP_SLOT_TEMP_4 2
  165. # elif BOOST_PP_SLOT_OFFSET_5(BOOST_PP_VALUE) / 1000UL == 3
  166. # define BOOST_PP_SLOT_TEMP_4 3
  167. # elif BOOST_PP_SLOT_OFFSET_5(BOOST_PP_VALUE) / 1000UL == 4
  168. # define BOOST_PP_SLOT_TEMP_4 4
  169. # elif BOOST_PP_SLOT_OFFSET_5(BOOST_PP_VALUE) / 1000UL == 5
  170. # define BOOST_PP_SLOT_TEMP_4 5
  171. # elif BOOST_PP_SLOT_OFFSET_5(BOOST_PP_VALUE) / 1000UL == 6
  172. # define BOOST_PP_SLOT_TEMP_4 6
  173. # elif BOOST_PP_SLOT_OFFSET_5(BOOST_PP_VALUE) / 1000UL == 7
  174. # define BOOST_PP_SLOT_TEMP_4 7
  175. # elif BOOST_PP_SLOT_OFFSET_5(BOOST_PP_VALUE) / 1000UL == 8
  176. # define BOOST_PP_SLOT_TEMP_4 8
  177. # elif BOOST_PP_SLOT_OFFSET_5(BOOST_PP_VALUE) / 1000UL == 9
  178. # define BOOST_PP_SLOT_TEMP_4 9
  179. # endif
  180. #
  181. # if BOOST_PP_SLOT_OFFSET_4(BOOST_PP_VALUE) / 100UL == 0
  182. # define BOOST_PP_SLOT_TEMP_3 0
  183. # elif BOOST_PP_SLOT_OFFSET_4(BOOST_PP_VALUE) / 100UL == 1
  184. # define BOOST_PP_SLOT_TEMP_3 1
  185. # elif BOOST_PP_SLOT_OFFSET_4(BOOST_PP_VALUE) / 100UL == 2
  186. # define BOOST_PP_SLOT_TEMP_3 2
  187. # elif BOOST_PP_SLOT_OFFSET_4(BOOST_PP_VALUE) / 100UL == 3
  188. # define BOOST_PP_SLOT_TEMP_3 3
  189. # elif BOOST_PP_SLOT_OFFSET_4(BOOST_PP_VALUE) / 100UL == 4
  190. # define BOOST_PP_SLOT_TEMP_3 4
  191. # elif BOOST_PP_SLOT_OFFSET_4(BOOST_PP_VALUE) / 100UL == 5
  192. # define BOOST_PP_SLOT_TEMP_3 5
  193. # elif BOOST_PP_SLOT_OFFSET_4(BOOST_PP_VALUE) / 100UL == 6
  194. # define BOOST_PP_SLOT_TEMP_3 6
  195. # elif BOOST_PP_SLOT_OFFSET_4(BOOST_PP_VALUE) / 100UL == 7
  196. # define BOOST_PP_SLOT_TEMP_3 7
  197. # elif BOOST_PP_SLOT_OFFSET_4(BOOST_PP_VALUE) / 100UL == 8
  198. # define BOOST_PP_SLOT_TEMP_3 8
  199. # elif BOOST_PP_SLOT_OFFSET_4(BOOST_PP_VALUE) / 100UL == 9
  200. # define BOOST_PP_SLOT_TEMP_3 9
  201. # endif
  202. #
  203. # if BOOST_PP_SLOT_OFFSET_3(BOOST_PP_VALUE) / 10UL == 0
  204. # define BOOST_PP_SLOT_TEMP_2 0
  205. # elif BOOST_PP_SLOT_OFFSET_3(BOOST_PP_VALUE) / 10UL == 1
  206. # define BOOST_PP_SLOT_TEMP_2 1
  207. # elif BOOST_PP_SLOT_OFFSET_3(BOOST_PP_VALUE) / 10UL == 2
  208. # define BOOST_PP_SLOT_TEMP_2 2
  209. # elif BOOST_PP_SLOT_OFFSET_3(BOOST_PP_VALUE) / 10UL == 3
  210. # define BOOST_PP_SLOT_TEMP_2 3
  211. # elif BOOST_PP_SLOT_OFFSET_3(BOOST_PP_VALUE) / 10UL == 4
  212. # define BOOST_PP_SLOT_TEMP_2 4
  213. # elif BOOST_PP_SLOT_OFFSET_3(BOOST_PP_VALUE) / 10UL == 5
  214. # define BOOST_PP_SLOT_TEMP_2 5
  215. # elif BOOST_PP_SLOT_OFFSET_3(BOOST_PP_VALUE) / 10UL == 6
  216. # define BOOST_PP_SLOT_TEMP_2 6
  217. # elif BOOST_PP_SLOT_OFFSET_3(BOOST_PP_VALUE) / 10UL == 7
  218. # define BOOST_PP_SLOT_TEMP_2 7
  219. # elif BOOST_PP_SLOT_OFFSET_3(BOOST_PP_VALUE) / 10UL == 8
  220. # define BOOST_PP_SLOT_TEMP_2 8
  221. # elif BOOST_PP_SLOT_OFFSET_3(BOOST_PP_VALUE) / 10UL == 9
  222. # define BOOST_PP_SLOT_TEMP_2 9
  223. # endif
  224. #
  225. # if BOOST_PP_SLOT_OFFSET_2(BOOST_PP_VALUE) == 0
  226. # define BOOST_PP_SLOT_TEMP_1 0
  227. # elif BOOST_PP_SLOT_OFFSET_2(BOOST_PP_VALUE) == 1
  228. # define BOOST_PP_SLOT_TEMP_1 1
  229. # elif BOOST_PP_SLOT_OFFSET_2(BOOST_PP_VALUE) == 2
  230. # define BOOST_PP_SLOT_TEMP_1 2
  231. # elif BOOST_PP_SLOT_OFFSET_2(BOOST_PP_VALUE) == 3
  232. # define BOOST_PP_SLOT_TEMP_1 3
  233. # elif BOOST_PP_SLOT_OFFSET_2(BOOST_PP_VALUE) == 4
  234. # define BOOST_PP_SLOT_TEMP_1 4
  235. # elif BOOST_PP_SLOT_OFFSET_2(BOOST_PP_VALUE) == 5
  236. # define BOOST_PP_SLOT_TEMP_1 5
  237. # elif BOOST_PP_SLOT_OFFSET_2(BOOST_PP_VALUE) == 6
  238. # define BOOST_PP_SLOT_TEMP_1 6
  239. # elif BOOST_PP_SLOT_OFFSET_2(BOOST_PP_VALUE) == 7
  240. # define BOOST_PP_SLOT_TEMP_1 7
  241. # elif BOOST_PP_SLOT_OFFSET_2(BOOST_PP_VALUE) == 8
  242. # define BOOST_PP_SLOT_TEMP_1 8
  243. # elif BOOST_PP_SLOT_OFFSET_2(BOOST_PP_VALUE) == 9
  244. # define BOOST_PP_SLOT_TEMP_1 9
  245. # endif
  246. #
  247. # undef BOOST_PP_VALUE