define_struct_inline.hpp 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529
  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. template <typename boost_fusion_detail_Seq, int N> \
  287. struct BOOST_FUSION_ITERATOR_NAME(NAME) \
  288. : boost::fusion::iterator_facade< \
  289. BOOST_FUSION_ITERATOR_NAME(NAME)<boost_fusion_detail_Seq, N>, \
  290. boost::fusion::random_access_traversal_tag \
  291. > \
  292. { \
  293. typedef boost::mpl::int_<N> index; \
  294. typedef boost_fusion_detail_Seq sequence_type; \
  295. \
  296. BOOST_FUSION_GPU_ENABLED \
  297. BOOST_FUSION_ITERATOR_NAME(NAME)(boost_fusion_detail_Seq& seq) \
  298. : seq_(seq) \
  299. BOOST_FUSION_DEFINE_ITERATOR_WKND_INIT_LIST_ENTRIES( \
  300. (0)ATTRIBUTES_SEQ) \
  301. {} \
  302. \
  303. boost_fusion_detail_Seq& seq_; \
  304. \
  305. BOOST_FUSION_DEFINE_ITERATOR_WKND_MEMBERS(ATTRIBUTES_SEQ_SIZE) \
  306. \
  307. BOOST_FUSION_DEFINE_ITERATOR_VALUE_OF(NAME, ATTRIBUTES_SEQ_SIZE) \
  308. \
  309. BOOST_FUSION_DEFINE_ITERATOR_DEREF(NAME, ATTRIBUTES_SEQ) \
  310. \
  311. template <typename boost_fusion_detail_It> \
  312. struct next \
  313. { \
  314. typedef BOOST_FUSION_ITERATOR_NAME(NAME)< \
  315. typename boost_fusion_detail_It::sequence_type, \
  316. boost_fusion_detail_It::index::value + 1 \
  317. > type; \
  318. \
  319. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED \
  320. static type call(boost_fusion_detail_It const& it) \
  321. { \
  322. return type(it.seq_); \
  323. } \
  324. }; \
  325. \
  326. template <typename boost_fusion_detail_It> \
  327. struct prior \
  328. { \
  329. typedef BOOST_FUSION_ITERATOR_NAME(NAME)< \
  330. typename boost_fusion_detail_It::sequence_type, \
  331. boost_fusion_detail_It::index::value - 1 \
  332. > type; \
  333. \
  334. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED \
  335. static type call(boost_fusion_detail_It const& it) \
  336. { \
  337. return type(it.seq_); \
  338. } \
  339. }; \
  340. \
  341. template < \
  342. typename boost_fusion_detail_It1, \
  343. typename boost_fusion_detail_It2 \
  344. > \
  345. struct distance \
  346. { \
  347. typedef typename boost::mpl::minus< \
  348. typename boost_fusion_detail_It2::index, \
  349. typename boost_fusion_detail_It1::index \
  350. >::type type; \
  351. \
  352. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED \
  353. static type call(boost_fusion_detail_It1 const& /* it1 */, \
  354. boost_fusion_detail_It2 const& /* it2 */) \
  355. { \
  356. return type(); \
  357. } \
  358. }; \
  359. \
  360. template < \
  361. typename boost_fusion_detail_It, \
  362. typename boost_fusion_detail_M \
  363. > \
  364. struct advance \
  365. { \
  366. typedef BOOST_FUSION_ITERATOR_NAME(NAME)< \
  367. typename boost_fusion_detail_It::sequence_type, \
  368. boost_fusion_detail_It::index::value \
  369. + boost_fusion_detail_M::value \
  370. > type; \
  371. \
  372. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED \
  373. static type call(boost_fusion_detail_It const& it) \
  374. { \
  375. return type(it.seq_); \
  376. } \
  377. }; \
  378. };
  379. #define BOOST_FUSION_DEFINE_STRUCT_INLINE_MEMBERS_IMPL_IMPL( \
  380. NAME, ATTRIBUTES_SEQ, ATTRIBUTES_SEQ_SIZE) \
  381. \
  382. NAME() \
  383. BOOST_PP_IF(ATTRIBUTES_SEQ_SIZE, \
  384. BOOST_FUSION_MAKE_DEFAULT_INIT_LIST, \
  385. BOOST_PP_EMPTY)(ATTRIBUTES_SEQ) \
  386. { \
  387. } \
  388. \
  389. BOOST_PP_IF( \
  390. ATTRIBUTES_SEQ_SIZE, \
  391. BOOST_FUSION_MAKE_COPY_CONSTRUCTOR, \
  392. BOOST_FUSION_IGNORE_2) \
  393. (NAME, ATTRIBUTES_SEQ) \
  394. \
  395. template <typename boost_fusion_detail_Seq> \
  396. BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED \
  397. NAME(const boost_fusion_detail_Seq& rhs) \
  398. { \
  399. boost::fusion::copy(rhs, *this); \
  400. } \
  401. \
  402. template <typename boost_fusion_detail_Seq> \
  403. BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED \
  404. NAME& operator=(const boost_fusion_detail_Seq& rhs) \
  405. { \
  406. boost::fusion::copy(rhs, *this); \
  407. return *this; \
  408. } \
  409. \
  410. template <typename boost_fusion_detail_Sq> \
  411. struct begin \
  412. { \
  413. typedef BOOST_FUSION_ITERATOR_NAME(NAME)<boost_fusion_detail_Sq, 0> \
  414. type; \
  415. \
  416. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED \
  417. static type call(boost_fusion_detail_Sq& sq) \
  418. { \
  419. return type(sq); \
  420. } \
  421. }; \
  422. \
  423. template <typename boost_fusion_detail_Sq> \
  424. struct end \
  425. { \
  426. typedef BOOST_FUSION_ITERATOR_NAME(NAME)< \
  427. boost_fusion_detail_Sq, \
  428. ATTRIBUTES_SEQ_SIZE \
  429. > type; \
  430. \
  431. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED \
  432. static type call(boost_fusion_detail_Sq& sq) \
  433. { \
  434. return type(sq); \
  435. } \
  436. }; \
  437. \
  438. template <typename boost_fusion_detail_Sq> \
  439. struct size : boost::mpl::int_<ATTRIBUTES_SEQ_SIZE> \
  440. { \
  441. }; \
  442. \
  443. template <typename boost_fusion_detail_Sq> \
  444. struct empty : boost::mpl::bool_<ATTRIBUTES_SEQ_SIZE == 0> \
  445. { \
  446. }; \
  447. \
  448. template < \
  449. typename boost_fusion_detail_Sq, \
  450. typename boost_fusion_detail_N \
  451. > \
  452. struct value_at : value_at< \
  453. boost_fusion_detail_Sq, \
  454. boost::mpl::int_<boost_fusion_detail_N::value> \
  455. > \
  456. { \
  457. }; \
  458. \
  459. BOOST_PP_REPEAT( \
  460. ATTRIBUTES_SEQ_SIZE, \
  461. BOOST_FUSION_MAKE_VALUE_AT_SPECS, \
  462. ~) \
  463. \
  464. template < \
  465. typename boost_fusion_detail_Sq, \
  466. typename boost_fusion_detail_N \
  467. > \
  468. struct at : at< \
  469. boost_fusion_detail_Sq, \
  470. boost::mpl::int_<boost_fusion_detail_N::value> \
  471. > \
  472. { \
  473. }; \
  474. \
  475. BOOST_PP_SEQ_FOR_EACH_I(BOOST_FUSION_MAKE_AT_SPECS, ~, ATTRIBUTES_SEQ) \
  476. \
  477. BOOST_PP_SEQ_FOR_EACH_I(BOOST_FUSION_MAKE_TYPEDEF, ~, ATTRIBUTES_SEQ) \
  478. \
  479. BOOST_PP_SEQ_FOR_EACH_I( \
  480. BOOST_FUSION_MAKE_DATA_MEMBER, \
  481. ~, \
  482. ATTRIBUTES_SEQ)
  483. #endif