define_struct_inline.hpp 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535
  1. /*=============================================================================
  2. Copyright (c) 2012 Nathan Ridge
  3. Distributed under the Boost Software License, Version 1.0. (See accompanying
  4. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. ==============================================================================*/
  6. #ifndef BOOST_FUSION_ADAPTED_STRUCT_DETAIL_DEFINE_STRUCT_INLINE_HPP
  7. #define BOOST_FUSION_ADAPTED_STRUCT_DETAIL_DEFINE_STRUCT_INLINE_HPP
  8. #include <boost/fusion/support/config.hpp>
  9. #include <boost/config.hpp>
  10. #include <boost/fusion/support/category_of.hpp>
  11. #include <boost/fusion/sequence/sequence_facade.hpp>
  12. #include <boost/fusion/iterator/iterator_facade.hpp>
  13. #include <boost/fusion/algorithm/auxiliary/copy.hpp>
  14. #include <boost/fusion/adapted/struct/detail/define_struct.hpp>
  15. #include <boost/mpl/int.hpp>
  16. #include <boost/mpl/bool.hpp>
  17. #include <boost/mpl/identity.hpp>
  18. #include <boost/mpl/minus.hpp>
  19. #include <boost/mpl/if.hpp>
  20. #include <boost/type_traits/is_const.hpp>
  21. #include <boost/preprocessor/comma_if.hpp>
  22. #include <boost/preprocessor/facilities/empty.hpp>
  23. #include <boost/preprocessor/repeat.hpp>
  24. #include <boost/preprocessor/seq/for_each_i.hpp>
  25. #include <boost/preprocessor/seq/size.hpp>
  26. #include <boost/preprocessor/seq/enum.hpp>
  27. #include <boost/preprocessor/seq/seq.hpp>
  28. #include <boost/preprocessor/tuple/elem.hpp>
  29. // MSVC and GCC <= 4.4 have a bug that affects partial specializations of
  30. // nested templates under some circumstances. This affects the implementation
  31. // of BOOST_FUSION_DEFINE_STRUCT_INLINE, which uses such specializations for
  32. // the iterator class's 'deref' and 'value_of' metafunctions. On these compilers
  33. // an alternate implementation for these metafunctions is used that does not
  34. // require such specializations. The alternate implementation takes longer
  35. // to compile so its use is restricted to the offending compilers.
  36. // For MSVC, the bug was reported at https://connect.microsoft.com/VisualStudio/feedback/details/757891/c-compiler-error-involving-partial-specializations-of-nested-templates
  37. // For GCC, 4.4 and earlier are no longer maintained so there is no need
  38. // to report a bug.
  39. #if defined(BOOST_MSVC) || (defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ <= 4)))
  40. #define BOOST_FUSION_NEED_NESTED_TEMPLATE_PARTIAL_SPEC_WKND
  41. #endif
  42. #ifdef BOOST_FUSION_NEED_NESTED_TEMPLATE_PARTIAL_SPEC_WKND
  43. #include <boost/type_traits/add_const.hpp>
  44. #include <boost/type_traits/remove_const.hpp>
  45. #include <boost/mpl/if.hpp>
  46. #include <boost/fusion/sequence/intrinsic/at_c.hpp>
  47. #include <boost/fusion/container/vector.hpp>
  48. #endif
  49. #define BOOST_FUSION_MAKE_DEFAULT_INIT_LIST_ENTRY(R, DATA, N, ATTRIBUTE) \
  50. BOOST_PP_COMMA_IF(N) BOOST_PP_TUPLE_ELEM(2, 1, ATTRIBUTE)()
  51. #define BOOST_FUSION_MAKE_DEFAULT_INIT_LIST(ATTRIBUTES_SEQ) \
  52. : BOOST_PP_SEQ_FOR_EACH_I( \
  53. BOOST_FUSION_MAKE_DEFAULT_INIT_LIST_ENTRY, \
  54. ~, \
  55. ATTRIBUTES_SEQ) \
  56. #define BOOST_FUSION_IGNORE_2(ARG1, ARG2)
  57. #define BOOST_FUSION_MAKE_COPY_CONSTRUCTOR(NAME, ATTRIBUTES_SEQ) \
  58. BOOST_FUSION_GPU_ENABLED \
  59. NAME(BOOST_PP_SEQ_FOR_EACH_I( \
  60. BOOST_FUSION_MAKE_CONST_REF_PARAM, \
  61. ~, \
  62. ATTRIBUTES_SEQ)) \
  63. : BOOST_PP_SEQ_FOR_EACH_I( \
  64. BOOST_FUSION_MAKE_INIT_LIST_ENTRY, \
  65. ~, \
  66. ATTRIBUTES_SEQ) \
  67. { \
  68. } \
  69. #define BOOST_FUSION_MAKE_CONST_REF_PARAM(R, DATA, N, ATTRIBUTE) \
  70. BOOST_PP_COMMA_IF(N) \
  71. BOOST_PP_TUPLE_ELEM(2, 0, ATTRIBUTE) const& \
  72. BOOST_PP_TUPLE_ELEM(2, 1, ATTRIBUTE)
  73. #define BOOST_FUSION_MAKE_INIT_LIST_ENTRY_I(NAME) NAME(NAME)
  74. #define BOOST_FUSION_MAKE_INIT_LIST_ENTRY(R, DATA, N, ATTRIBUTE) \
  75. BOOST_PP_COMMA_IF(N) \
  76. BOOST_FUSION_MAKE_INIT_LIST_ENTRY_I(BOOST_PP_TUPLE_ELEM(2, 1, ATTRIBUTE))
  77. #define BOOST_FUSION_ITERATOR_NAME(NAME) \
  78. BOOST_PP_CAT(boost_fusion_detail_, BOOST_PP_CAT(NAME, _iterator))
  79. // Note: all template parameter names need to be uglified, otherwise they might
  80. // shadow a template parameter of the struct when used with
  81. // BOOST_FUSION_DEFINE_TPL_STRUCT_INLINE
  82. #define BOOST_FUSION_MAKE_ITERATOR_VALUE_OF_SPECS(Z, N, NAME) \
  83. template <typename boost_fusion_detail_Sq> \
  84. struct value_of< \
  85. BOOST_FUSION_ITERATOR_NAME(NAME)<boost_fusion_detail_Sq, N> \
  86. > \
  87. : boost::mpl::identity< \
  88. typename boost_fusion_detail_Sq::t##N##_type \
  89. > \
  90. { \
  91. };
  92. #define BOOST_FUSION_MAKE_ITERATOR_DEREF_SPEC( \
  93. SPEC_TYPE, CALL_ARG_TYPE, TYPE_QUAL, ATTRIBUTE, N) \
  94. \
  95. template <typename boost_fusion_detail_Sq> \
  96. struct deref<SPEC_TYPE, N> > \
  97. { \
  98. typedef typename boost_fusion_detail_Sq::t##N##_type TYPE_QUAL& type; \
  99. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED \
  100. static type call(CALL_ARG_TYPE, N> const& iter) \
  101. { \
  102. return iter.seq_.BOOST_PP_TUPLE_ELEM(2, 1, ATTRIBUTE); \
  103. } \
  104. };
  105. #define BOOST_FUSION_MAKE_ITERATOR_DEREF_SPECS(R, NAME, N, ATTRIBUTE) \
  106. BOOST_FUSION_MAKE_ITERATOR_DEREF_SPEC( \
  107. BOOST_FUSION_ITERATOR_NAME(NAME)<boost_fusion_detail_Sq, \
  108. BOOST_FUSION_ITERATOR_NAME(NAME)<boost_fusion_detail_Sq, \
  109. , \
  110. ATTRIBUTE, \
  111. N) \
  112. BOOST_FUSION_MAKE_ITERATOR_DEREF_SPEC( \
  113. BOOST_FUSION_ITERATOR_NAME(NAME)<const boost_fusion_detail_Sq, \
  114. BOOST_FUSION_ITERATOR_NAME(NAME)<const boost_fusion_detail_Sq, \
  115. const, \
  116. ATTRIBUTE, \
  117. N) \
  118. BOOST_FUSION_MAKE_ITERATOR_DEREF_SPEC( \
  119. const BOOST_FUSION_ITERATOR_NAME(NAME)<boost_fusion_detail_Sq, \
  120. BOOST_FUSION_ITERATOR_NAME(NAME)<boost_fusion_detail_Sq, \
  121. , \
  122. ATTRIBUTE, \
  123. N) \
  124. BOOST_FUSION_MAKE_ITERATOR_DEREF_SPEC( \
  125. const BOOST_FUSION_ITERATOR_NAME(NAME)<const boost_fusion_detail_Sq, \
  126. BOOST_FUSION_ITERATOR_NAME(NAME)<const boost_fusion_detail_Sq, \
  127. const, \
  128. ATTRIBUTE, \
  129. N) \
  130. #define BOOST_FUSION_MAKE_VALUE_AT_SPECS(Z, N, DATA) \
  131. template <typename boost_fusion_detail_Sq> \
  132. struct value_at<boost_fusion_detail_Sq, boost::mpl::int_<N> > \
  133. { \
  134. typedef typename boost_fusion_detail_Sq::t##N##_type type; \
  135. };
  136. #define BOOST_FUSION_MAKE_AT_SPECS(R, DATA, N, ATTRIBUTE) \
  137. template <typename boost_fusion_detail_Sq> \
  138. struct at<boost_fusion_detail_Sq, boost::mpl::int_<N> > \
  139. { \
  140. typedef typename boost::mpl::if_< \
  141. boost::is_const<boost_fusion_detail_Sq>, \
  142. typename boost_fusion_detail_Sq::t##N##_type const&, \
  143. typename boost_fusion_detail_Sq::t##N##_type& \
  144. >::type type; \
  145. \
  146. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED \
  147. static type call(boost_fusion_detail_Sq& sq) \
  148. { \
  149. return sq. BOOST_PP_TUPLE_ELEM(2, 1, ATTRIBUTE); \
  150. } \
  151. };
  152. #define BOOST_FUSION_MAKE_TYPEDEF(R, DATA, N, ATTRIBUTE) \
  153. typedef BOOST_PP_TUPLE_ELEM(2, 0, ATTRIBUTE) t##N##_type;
  154. #define BOOST_FUSION_MAKE_DATA_MEMBER(R, DATA, N, ATTRIBUTE) \
  155. BOOST_PP_TUPLE_ELEM(2, 0, ATTRIBUTE) BOOST_PP_TUPLE_ELEM(2, 1, ATTRIBUTE);
  156. #ifdef BOOST_FUSION_NEED_NESTED_TEMPLATE_PARTIAL_SPEC_WKND
  157. #define BOOST_FUSION_DEFINE_ITERATOR_VALUE_OF(NAME, ATTRIBUTE_SEQ_SIZE) \
  158. template <typename boost_fusion_detail_Iterator> \
  159. struct value_of : boost::fusion::result_of::at_c< \
  160. ref_vec_t, \
  161. boost_fusion_detail_Iterator::index::value \
  162. > \
  163. { \
  164. };
  165. #define BOOST_FUSION_DEFINE_ITERATOR_DEREF(NAME, ATTRIBUTES_SEQ) \
  166. template <typename boost_fusion_detail_Iterator> \
  167. struct deref \
  168. { \
  169. typedef typename boost::remove_const< \
  170. boost_fusion_detail_Iterator \
  171. >::type iterator_raw_type; \
  172. \
  173. static const int index = iterator_raw_type::index::value; \
  174. \
  175. typedef typename boost::fusion::result_of::at_c< \
  176. ref_vec_t, \
  177. index \
  178. >::type result_raw_type; \
  179. \
  180. typedef typename boost::mpl::if_< \
  181. boost::is_const<typename iterator_raw_type::sequence_type>, \
  182. typename boost::add_const<result_raw_type>::type, \
  183. result_raw_type \
  184. >::type type; \
  185. \
  186. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED \
  187. static type call(iterator_raw_type const& iter) \
  188. { \
  189. return boost::fusion::at_c<index>(iter.ref_vec); \
  190. } \
  191. };
  192. #define BOOST_FUSION_MAKE_ITERATOR_WKND_FIELD_NAME(R, DATA, N, ATTRIBUTE) \
  193. BOOST_PP_COMMA_IF(N) seq.BOOST_PP_TUPLE_ELEM(2, 1, ATTRIBUTE)
  194. #define BOOST_FUSION_DEFINE_ITERATOR_WKND_INIT_LIST_ENTRIES(ATTRIBUTES_SEQ) \
  195. , ref_vec(BOOST_PP_SEQ_FOR_EACH_I( \
  196. BOOST_FUSION_MAKE_ITERATOR_WKND_FIELD_NAME, \
  197. ~, \
  198. BOOST_PP_SEQ_TAIL(ATTRIBUTES_SEQ)))
  199. #define BOOST_FUSION_MAKE_ITERATOR_WKND_REF(Z, N, DATA) \
  200. BOOST_PP_COMMA_IF(N) \
  201. typename boost::mpl::if_< \
  202. boost::is_const<boost_fusion_detail_Seq>, \
  203. typename boost::add_const< \
  204. typename boost_fusion_detail_Seq::t##N##_type \
  205. >::type, \
  206. typename boost_fusion_detail_Seq::t##N##_type \
  207. >::type&
  208. #define BOOST_FUSION_DEFINE_ITERATOR_WKND_MEMBERS(ATTRIBUTES_SEQ_SIZE) \
  209. typedef boost::fusion::vector< \
  210. BOOST_PP_REPEAT( \
  211. ATTRIBUTES_SEQ_SIZE, \
  212. BOOST_FUSION_MAKE_ITERATOR_WKND_REF, \
  213. ~) \
  214. > ref_vec_t; \
  215. \
  216. ref_vec_t ref_vec;
  217. #else
  218. #define BOOST_FUSION_DEFINE_ITERATOR_VALUE_OF(NAME, ATTRIBUTES_SEQ_SIZE) \
  219. template <typename boost_fusion_detail_T> struct value_of; \
  220. BOOST_PP_REPEAT( \
  221. ATTRIBUTES_SEQ_SIZE, \
  222. BOOST_FUSION_MAKE_ITERATOR_VALUE_OF_SPECS, \
  223. NAME)
  224. #define BOOST_FUSION_DEFINE_ITERATOR_DEREF(NAME, ATTRIBUTES_SEQ) \
  225. template <typename boost_fusion_detail_T> struct deref; \
  226. BOOST_PP_SEQ_FOR_EACH_I( \
  227. BOOST_FUSION_MAKE_ITERATOR_DEREF_SPECS, \
  228. NAME, \
  229. ATTRIBUTES_SEQ)
  230. #define BOOST_FUSION_DEFINE_ITERATOR_WKND_INIT_LIST_ENTRIES(ATTRIBUTES_SEQ)
  231. #define BOOST_FUSION_DEFINE_ITERATOR_WKND_MEMBERS(ATTRIBUTES_SEQ_SIZE)
  232. #endif // BOOST_FUSION_NEED_NESTED_TEMPLATE_PARTIAL_SPEC_WKND
  233. // Note: We can't nest the iterator inside the struct because we run into
  234. // a MSVC10 bug involving partial specializations of nested templates.
  235. #define BOOST_FUSION_DEFINE_STRUCT_INLINE_IMPL(NAME, ATTRIBUTES) \
  236. BOOST_FUSION_DEFINE_STRUCT_INLINE_ITERATOR(NAME, ATTRIBUTES) \
  237. struct NAME : boost::fusion::sequence_facade< \
  238. NAME, \
  239. boost::fusion::random_access_traversal_tag \
  240. > \
  241. { \
  242. BOOST_FUSION_DEFINE_STRUCT_INLINE_MEMBERS(NAME, ATTRIBUTES) \
  243. };
  244. #define BOOST_FUSION_DEFINE_TPL_STRUCT_INLINE_IMPL( \
  245. TEMPLATE_PARAMS_SEQ, NAME, ATTRIBUTES) \
  246. \
  247. BOOST_FUSION_DEFINE_STRUCT_INLINE_ITERATOR(NAME, ATTRIBUTES) \
  248. \
  249. template < \
  250. BOOST_FUSION_ADAPT_STRUCT_UNPACK_TEMPLATE_PARAMS_IMPL( \
  251. (0)TEMPLATE_PARAMS_SEQ) \
  252. > \
  253. struct NAME : boost::fusion::sequence_facade< \
  254. NAME< \
  255. BOOST_PP_SEQ_ENUM(TEMPLATE_PARAMS_SEQ) \
  256. >, \
  257. boost::fusion::random_access_traversal_tag \
  258. > \
  259. { \
  260. BOOST_FUSION_DEFINE_STRUCT_INLINE_MEMBERS(NAME, ATTRIBUTES) \
  261. };
  262. #define BOOST_FUSION_DEFINE_STRUCT_INLINE_MEMBERS(NAME, ATTRIBUTES) \
  263. BOOST_FUSION_DEFINE_STRUCT_MEMBERS_IMPL( \
  264. NAME, \
  265. BOOST_PP_CAT(BOOST_FUSION_DEFINE_STRUCT_FILLER_0 ATTRIBUTES,_END))
  266. // Note: can't compute BOOST_PP_SEQ_SIZE(ATTRIBUTES_SEQ) directly because
  267. // ATTRIBUTES_SEQ may be empty and calling BOOST_PP_SEQ_SIZE on an empty
  268. // sequence produces warnings on MSVC.
  269. #define BOOST_FUSION_DEFINE_STRUCT_MEMBERS_IMPL(NAME, ATTRIBUTES_SEQ) \
  270. BOOST_FUSION_DEFINE_STRUCT_INLINE_MEMBERS_IMPL_IMPL( \
  271. NAME, \
  272. ATTRIBUTES_SEQ, \
  273. BOOST_PP_DEC(BOOST_PP_SEQ_SIZE((0)ATTRIBUTES_SEQ)))
  274. #define BOOST_FUSION_DEFINE_STRUCT_INLINE_ITERATOR(NAME, ATTRIBUTES) \
  275. BOOST_FUSION_DEFINE_STRUCT_ITERATOR_IMPL( \
  276. NAME, \
  277. BOOST_PP_CAT(BOOST_FUSION_DEFINE_STRUCT_FILLER_0 ATTRIBUTES,_END))
  278. #define BOOST_FUSION_DEFINE_STRUCT_ITERATOR_IMPL(NAME, ATTRIBUTES_SEQ) \
  279. BOOST_FUSION_DEFINE_STRUCT_INLINE_ITERATOR_IMPL_IMPL( \
  280. NAME, \
  281. ATTRIBUTES_SEQ, \
  282. BOOST_PP_DEC(BOOST_PP_SEQ_SIZE((0)ATTRIBUTES_SEQ)))
  283. #define BOOST_FUSION_DEFINE_STRUCT_INLINE_ITERATOR_IMPL_IMPL( \
  284. NAME, ATTRIBUTES_SEQ, ATTRIBUTES_SEQ_SIZE) \
  285. \
  286. BOOST_FUSION_PUSH_WARNINGS \
  287. BOOST_FUSION_DISABLE_MSVC_WARNING(4512) \
  288. \
  289. template <typename boost_fusion_detail_Seq, int N> \
  290. struct BOOST_FUSION_ITERATOR_NAME(NAME) \
  291. : boost::fusion::iterator_facade< \
  292. BOOST_FUSION_ITERATOR_NAME(NAME)<boost_fusion_detail_Seq, N>, \
  293. boost::fusion::random_access_traversal_tag \
  294. > \
  295. { \
  296. typedef boost::mpl::int_<N> index; \
  297. typedef boost_fusion_detail_Seq sequence_type; \
  298. \
  299. BOOST_FUSION_GPU_ENABLED \
  300. BOOST_FUSION_ITERATOR_NAME(NAME)(boost_fusion_detail_Seq& seq) \
  301. : seq_(seq) \
  302. BOOST_FUSION_DEFINE_ITERATOR_WKND_INIT_LIST_ENTRIES( \
  303. (0)ATTRIBUTES_SEQ) \
  304. {} \
  305. \
  306. boost_fusion_detail_Seq& seq_; \
  307. \
  308. BOOST_FUSION_DEFINE_ITERATOR_WKND_MEMBERS(ATTRIBUTES_SEQ_SIZE) \
  309. \
  310. BOOST_FUSION_DEFINE_ITERATOR_VALUE_OF(NAME, ATTRIBUTES_SEQ_SIZE) \
  311. \
  312. BOOST_FUSION_DEFINE_ITERATOR_DEREF(NAME, ATTRIBUTES_SEQ) \
  313. \
  314. template <typename boost_fusion_detail_It> \
  315. struct next \
  316. { \
  317. typedef BOOST_FUSION_ITERATOR_NAME(NAME)< \
  318. typename boost_fusion_detail_It::sequence_type, \
  319. boost_fusion_detail_It::index::value + 1 \
  320. > type; \
  321. \
  322. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED \
  323. static type call(boost_fusion_detail_It const& it) \
  324. { \
  325. return type(it.seq_); \
  326. } \
  327. }; \
  328. \
  329. template <typename boost_fusion_detail_It> \
  330. struct prior \
  331. { \
  332. typedef BOOST_FUSION_ITERATOR_NAME(NAME)< \
  333. typename boost_fusion_detail_It::sequence_type, \
  334. boost_fusion_detail_It::index::value - 1 \
  335. > type; \
  336. \
  337. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED \
  338. static type call(boost_fusion_detail_It const& it) \
  339. { \
  340. return type(it.seq_); \
  341. } \
  342. }; \
  343. \
  344. template < \
  345. typename boost_fusion_detail_It1, \
  346. typename boost_fusion_detail_It2 \
  347. > \
  348. struct distance \
  349. { \
  350. typedef typename boost::mpl::minus< \
  351. typename boost_fusion_detail_It2::index, \
  352. typename boost_fusion_detail_It1::index \
  353. >::type type; \
  354. \
  355. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED \
  356. static type call(boost_fusion_detail_It1 const& /* it1 */, \
  357. boost_fusion_detail_It2 const& /* it2 */) \
  358. { \
  359. return type(); \
  360. } \
  361. }; \
  362. \
  363. template < \
  364. typename boost_fusion_detail_It, \
  365. typename boost_fusion_detail_M \
  366. > \
  367. struct advance \
  368. { \
  369. typedef BOOST_FUSION_ITERATOR_NAME(NAME)< \
  370. typename boost_fusion_detail_It::sequence_type, \
  371. boost_fusion_detail_It::index::value \
  372. + boost_fusion_detail_M::value \
  373. > type; \
  374. \
  375. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED \
  376. static type call(boost_fusion_detail_It const& it) \
  377. { \
  378. return type(it.seq_); \
  379. } \
  380. }; \
  381. }; \
  382. \
  383. BOOST_FUSION_POP_WARNINGS \
  384. /**/
  385. #define BOOST_FUSION_DEFINE_STRUCT_INLINE_MEMBERS_IMPL_IMPL( \
  386. NAME, ATTRIBUTES_SEQ, ATTRIBUTES_SEQ_SIZE) \
  387. \
  388. NAME() \
  389. BOOST_PP_IF(ATTRIBUTES_SEQ_SIZE, \
  390. BOOST_FUSION_MAKE_DEFAULT_INIT_LIST, \
  391. BOOST_PP_EMPTY)(ATTRIBUTES_SEQ) \
  392. { \
  393. } \
  394. \
  395. BOOST_PP_IF( \
  396. ATTRIBUTES_SEQ_SIZE, \
  397. BOOST_FUSION_MAKE_COPY_CONSTRUCTOR, \
  398. BOOST_FUSION_IGNORE_2) \
  399. (NAME, ATTRIBUTES_SEQ) \
  400. \
  401. template <typename boost_fusion_detail_Seq> \
  402. BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED \
  403. NAME(const boost_fusion_detail_Seq& rhs) \
  404. { \
  405. boost::fusion::copy(rhs, *this); \
  406. } \
  407. \
  408. template <typename boost_fusion_detail_Seq> \
  409. BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED \
  410. NAME& operator=(const boost_fusion_detail_Seq& rhs) \
  411. { \
  412. boost::fusion::copy(rhs, *this); \
  413. return *this; \
  414. } \
  415. \
  416. template <typename boost_fusion_detail_Sq> \
  417. struct begin \
  418. { \
  419. typedef BOOST_FUSION_ITERATOR_NAME(NAME)<boost_fusion_detail_Sq, 0> \
  420. type; \
  421. \
  422. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED \
  423. static type call(boost_fusion_detail_Sq& sq) \
  424. { \
  425. return type(sq); \
  426. } \
  427. }; \
  428. \
  429. template <typename boost_fusion_detail_Sq> \
  430. struct end \
  431. { \
  432. typedef BOOST_FUSION_ITERATOR_NAME(NAME)< \
  433. boost_fusion_detail_Sq, \
  434. ATTRIBUTES_SEQ_SIZE \
  435. > type; \
  436. \
  437. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED \
  438. static type call(boost_fusion_detail_Sq& sq) \
  439. { \
  440. return type(sq); \
  441. } \
  442. }; \
  443. \
  444. template <typename boost_fusion_detail_Sq> \
  445. struct size : boost::mpl::int_<ATTRIBUTES_SEQ_SIZE> \
  446. { \
  447. }; \
  448. \
  449. template <typename boost_fusion_detail_Sq> \
  450. struct empty : boost::mpl::bool_<ATTRIBUTES_SEQ_SIZE == 0> \
  451. { \
  452. }; \
  453. \
  454. template < \
  455. typename boost_fusion_detail_Sq, \
  456. typename boost_fusion_detail_N \
  457. > \
  458. struct value_at : value_at< \
  459. boost_fusion_detail_Sq, \
  460. boost::mpl::int_<boost_fusion_detail_N::value> \
  461. > \
  462. { \
  463. }; \
  464. \
  465. BOOST_PP_REPEAT( \
  466. ATTRIBUTES_SEQ_SIZE, \
  467. BOOST_FUSION_MAKE_VALUE_AT_SPECS, \
  468. ~) \
  469. \
  470. template < \
  471. typename boost_fusion_detail_Sq, \
  472. typename boost_fusion_detail_N \
  473. > \
  474. struct at : at< \
  475. boost_fusion_detail_Sq, \
  476. boost::mpl::int_<boost_fusion_detail_N::value> \
  477. > \
  478. { \
  479. }; \
  480. \
  481. BOOST_PP_SEQ_FOR_EACH_I(BOOST_FUSION_MAKE_AT_SPECS, ~, ATTRIBUTES_SEQ) \
  482. \
  483. BOOST_PP_SEQ_FOR_EACH_I(BOOST_FUSION_MAKE_TYPEDEF, ~, ATTRIBUTES_SEQ) \
  484. \
  485. BOOST_PP_SEQ_FOR_EACH_I( \
  486. BOOST_FUSION_MAKE_DATA_MEMBER, \
  487. ~, \
  488. ATTRIBUTES_SEQ)
  489. #endif