container.qbk 59 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247
  1. [/==============================================================================
  2. Copyright (C) 2001-2011 Joel de Guzman
  3. Copyright (C) 2006 Dan Marsden
  4. Use, modification and distribution is subject to the Boost Software
  5. License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  6. http://www.boost.org/LICENSE_1_0.txt)
  7. ===============================================================================/]
  8. [section Container]
  9. Fusion provides a few predefined sequences out of the box. These
  10. /containers/ actually hold heterogeneously typed data; unlike
  11. __views__. These containers are more or less counterparts of those in __stl__.
  12. [heading Header]
  13. #include <boost/fusion/container.hpp>
  14. #include <boost/fusion/include/container.hpp>
  15. [section vector]
  16. [heading Description]
  17. `vector` is a __random_access_sequence__ of heterogeneous typed data
  18. structured as a simple `struct` where each element is held as a member
  19. variable. `vector` is the simplest of the Fusion sequence container (a
  20. vector with N elements is just a struct with N members), and in many
  21. cases the most efficient.
  22. [heading Header]
  23. #include <boost/fusion/container/vector.hpp>
  24. #include <boost/fusion/include/vector.hpp>
  25. #include <boost/fusion/container/vector/vector_fwd.hpp>
  26. #include <boost/fusion/include/vector_fwd.hpp>
  27. // numbered forms
  28. #include <boost/fusion/container/vector/vector10.hpp>
  29. #include <boost/fusion/include/vector10.hpp>
  30. #include <boost/fusion/container/vector/vector20.hpp>
  31. #include <boost/fusion/include/vector20.hpp>
  32. #include <boost/fusion/container/vector/vector30.hpp>
  33. #include <boost/fusion/include/vector30.hpp>
  34. #include <boost/fusion/container/vector/vector40.hpp>
  35. #include <boost/fusion/include/vector40.hpp>
  36. #include <boost/fusion/container/vector/vector50.hpp>
  37. #include <boost/fusion/include/vector50.hpp>
  38. [heading Synopsis]
  39. [*Numbered forms]
  40. struct vector0;
  41. template <typename T0>
  42. struct vector1;
  43. template <typename T0, typename T1>
  44. struct vector2;
  45. template <typename T0, typename T1, typename T2>
  46. struct vector3;
  47. ...
  48. template <typename T0, typename T1, typename T2..., typename TN>
  49. struct vectorN;
  50. [important Numbered forms will be deprecated in C++11 and it will be provided
  51. via aliasing templates. It means that your partial specialization
  52. might be compile error. You can detect whether it is aliasing
  53. templates or not, using `BOOST_FUSION_HAS_VARIADIC_VECTOR`.]
  54. [*Variadic form]
  55. template <
  56. typename T0 = __unspecified__
  57. , typename T1 = __unspecified__
  58. , typename T2 = __unspecified__
  59. ...
  60. , typename TN = __unspecified__
  61. >
  62. struct vector;
  63. The numbered form accepts the exact number of elements. Example:
  64. vector3<int, char, double>
  65. For C++11 compilers, the variadic function interface has no upper bound.
  66. For C++03 compilers, the The variadic form accepts `0` to
  67. `FUSION_MAX_VECTOR_SIZE` elements, where `FUSION_MAX_VECTOR_SIZE` is a
  68. user definable predefined maximum that defaults to `10`. Example:
  69. vector<int, char, double>
  70. You may define the preprocessor constant `FUSION_MAX_VECTOR_SIZE` before
  71. including any Fusion header to change the default. Example:
  72. #define FUSION_MAX_VECTOR_SIZE 20
  73. [heading Template parameters]
  74. [table
  75. [[Parameter] [Description] [Default]]
  76. [[`T0`...`TN`] [Element types] [__unspecified__]]
  77. ]
  78. [heading Model of]
  79. * __random_access_sequence__
  80. [variablelist Notation
  81. [[`v`] [Instance of `vector`]]
  82. [[`V`] [A `vector` type]]
  83. [[`e0`...`en`] [Heterogeneous values]]
  84. [[`s`] [A __forward_sequence__]]
  85. ]
  86. [heading Expression Semantics]
  87. Semantics of an expression is defined only where it differs from, or is not
  88. defined in __random_access_sequence__.
  89. [table
  90. [[Expression] [Semantics]]
  91. [[`V()`] [Creates a vector with default constructed elements.]]
  92. [[`V(e0, e1,... en)`] [Creates a vector with elements `e0`...`en`.]]
  93. [[`V(s)`] [Copy constructs a vector from a __forward_sequence__, `s`.]]
  94. [[`v = s`] [Assigns to a vector, `v`, from a __forward_sequence__, `s`.]]
  95. ]
  96. [heading Example]
  97. vector<int, float> v(12, 5.5f);
  98. std::cout << __at_c__<0>(v) << std::endl;
  99. std::cout << __at_c__<1>(v) << std::endl;
  100. [endsect]
  101. [section cons]
  102. [heading Description]
  103. `cons` is a simple __forward_sequence__. It is a lisp style recursive list
  104. structure where `car` is the /head/ and `cdr` is the /tail/: usually
  105. another cons structure or `nil`: the empty list. Fusion's __list__ is built
  106. on top of this more primitive data structure. It is more efficient than
  107. __vector__ when the target sequence is constructed piecemeal (a data at a
  108. time). The runtime cost of access to each element is peculiarly constant
  109. (see __recursive_inline__).
  110. [heading Header]
  111. #include <boost/fusion/container/list/cons.hpp>
  112. #include <boost/fusion/include/cons.hpp>
  113. [heading Synopsis]
  114. template <typename Car, typename Cdr = nil>
  115. struct cons;
  116. [heading Template parameters]
  117. [table
  118. [[Parameter] [Description] [Default]]
  119. [[`Car`] [Head type] [ ]]
  120. [[`Cdr`] [Tail type] [`nil`]]
  121. ]
  122. [heading Model of]
  123. * __forward_sequence__
  124. [variablelist Notation
  125. [[`nil`] [An empty `cons`]]
  126. [[`C`] [A `cons` type]]
  127. [[`l`, `l2`] [Instances of `cons`]]
  128. [[`car`] [An arbitrary data]]
  129. [[`cdr`] [Another `cons` list]]
  130. [[`s`] [A __forward_sequence__]]
  131. [[`N`] [An __mpl_integral_constant__]]
  132. ]
  133. [heading Expression Semantics]
  134. Semantics of an expression is defined only where it differs from, or is not
  135. defined in __forward_sequence__.
  136. [table
  137. [[Expression] [Semantics]]
  138. [[`nil()`] [Creates an empty list.]]
  139. [[`C()`] [Creates a cons with default constructed elements.]]
  140. [[`C(car)`] [Creates a cons with `car` head and default constructed tail.]]
  141. [[`C(car, cdr)`] [Creates a cons with `car` head and `cdr` tail.]]
  142. [[`C(s)`] [Copy constructs a cons from a __forward_sequence__, `s`.]]
  143. [[`l = s`] [Assigns to a cons, `l`, from a __forward_sequence__, `s`.]]
  144. [[`__at__<N>(l)`] [The Nth element from the beginning of the sequence; see __at__.]]
  145. ]
  146. [note `__at__<N>(l)` is provided for convenience and compatibility
  147. with the original __tuple__ library, despite `cons` being a
  148. __forward_sequence__ only (`at` is supposed to be a
  149. __random_access_sequence__ requirement). The runtime complexity of __at__ is
  150. constant (see __recursive_inline__).]
  151. [heading Example]
  152. cons<int, cons<float> > l(12, cons<float>(5.5f));
  153. std::cout << __at_c__<0>(l) << std::endl;
  154. std::cout << __at_c__<1>(l) << std::endl;
  155. [endsect]
  156. [section list]
  157. [heading Description]
  158. `list` is a __forward_sequence__ of heterogeneous typed data built on top of
  159. __cons__. It is more efficient than __vector__ when the target sequence is
  160. constructed piecemeal (a data at a time). The runtime cost of access to
  161. each element is peculiarly constant (see __recursive_inline__).
  162. [heading Header]
  163. #include <boost/fusion/container/list.hpp>
  164. #include <boost/fusion/include/list.hpp>
  165. #include <boost/fusion/container/list/list_fwd.hpp>
  166. #include <boost/fusion/include/list_fwd.hpp>
  167. [heading Synopsis]
  168. template <
  169. typename T0 = __unspecified__
  170. , typename T1 = __unspecified__
  171. , typename T2 = __unspecified__
  172. ...
  173. , typename TN = __unspecified__
  174. >
  175. struct list;
  176. For C++11 compilers, the variadic function interface has no upper bound.
  177. For C++03 compilers, the variadic class interface accepts `0` to
  178. `FUSION_MAX_LIST_SIZE` elements, where `FUSION_MAX_LIST_SIZE` is a user
  179. definable predefined maximum that defaults to `10`. Example:
  180. list<int, char, double>
  181. You may define the preprocessor constant `FUSION_MAX_LIST_SIZE` before
  182. including any Fusion header to change the default. Example:
  183. #define FUSION_MAX_LIST_SIZE 20
  184. [heading Template parameters]
  185. [table
  186. [[Parameter] [Description] [Default]]
  187. [[`T0`...`TN`] [Element types] [__unspecified__]]
  188. ]
  189. [heading Model of]
  190. * __forward_sequence__
  191. [variablelist Notation
  192. [[`L`] [A `list` type]]
  193. [[`l`] [An instance of `list`]]
  194. [[`e0`...`en`] [Heterogeneous values]]
  195. [[`s`] [A __forward_sequence__]]
  196. [[`N`] [An __mpl_integral_constant__]]
  197. ]
  198. [heading Expression Semantics]
  199. Semantics of an expression is defined only where it differs from, or is not
  200. defined in __forward_sequence__.
  201. [table
  202. [[Expression] [Semantics]]
  203. [[`L()`] [Creates a list with default constructed elements.]]
  204. [[`L(e0, e1,... en)`] [Creates a list with elements `e0`...`en`.]]
  205. [[`L(s)`] [Copy constructs a list from a __forward_sequence__, `s`.]]
  206. [[`l = s`] [Assigns to a list, `l`, from a __forward_sequence__, `s`.]]
  207. [[`__at__<N>(l)`] [The Nth element from the beginning of the sequence; see __at__.]]
  208. ]
  209. [note `__at__<n>(l)` is provided for convenience and compatibility
  210. with the original __tuple__ library, despite `list` being a
  211. __forward_sequence__ only (__at__ is supposed to be a
  212. __random_access_sequence__ requirement). The runtime complexity of __at__ is
  213. constant (see __recursive_inline__).]
  214. [heading Example]
  215. list<int, float> l(12, 5.5f);
  216. std::cout << __at_c__<0>(l) << std::endl;
  217. std::cout << __at_c__<1>(l) << std::endl;
  218. [endsect]
  219. [section deque]
  220. [heading Description]
  221. `deque` is a simple __bidirectional_sequence__ that supports
  222. constant-time insertion and removal of elements at both ends. Like the
  223. __list__ and __cons__, `deque` is more efficient than __vector__
  224. (especially at compile time) when the target sequence is constructed
  225. piecemeal (a data at a time, e.g. when constructing expression
  226. templates). Like the __list__ and __cons__, runtime cost of access to
  227. each element is peculiarly constant (see __recursive_inline__).
  228. Element insertion and removal are done by special `deque` helper classes
  229. __front_extended_deque__ and __back_extended_deque__.
  230. [heading Header]
  231. #include <boost/fusion/container/deque.hpp>
  232. #include <boost/fusion/include/deque.hpp>
  233. #include <boost/fusion/container/deque/deque_fwd.hpp>
  234. #include <boost/fusion/include/deque_fwd.hpp>
  235. [heading Synopsis]
  236. template <typename ...Elements>
  237. struct deque;
  238. For C++11 compilers, the variadic class interface has no upper bound.
  239. For C++03 compilers, the variadic class interface accepts `0` to
  240. `FUSION_MAX_DEQUE_SIZE` elements, where `FUSION_MAX_DEQUE_SIZE` is a
  241. user definable predefined maximum that defaults to `10`. Example:
  242. deque<int, char, double>
  243. You may define the preprocessor constant `FUSION_MAX_DEQUE_SIZE` before
  244. including any Fusion header to change the default. Example:
  245. #define FUSION_MAX_DEQUE_SIZE 20
  246. [heading Template parameters]
  247. [table
  248. [[Parameter] [Description] [Default]]
  249. [[`Elements`] [Element types] [ ]]
  250. ]
  251. [heading Model of]
  252. * __bidirectional_sequence__
  253. [variablelist Notation
  254. [[`D`] [A `deque` type]]
  255. [[`d`, `d2`] [Instances of `deque`]]
  256. [[`e0`...`en`] [Heterogeneous values]]
  257. [[`s`] [A __forward_sequence__]]
  258. [[`N`] [An __mpl_integral_constant__]]
  259. ]
  260. [heading Expression Semantics]
  261. Semantics of an expression is defined only where it differs from, or is not
  262. defined in __bidirectional_sequence__.
  263. [table
  264. [[Expression] [Semantics]]
  265. [[`D()`] [Creates a deque with default constructed elements.]]
  266. [[`D(e0, e1,... en)`] [Creates a deque with elements `e0`...`en`.]]
  267. [[`D(s)`] [Copy constructs a deque from a __forward_sequence__, `s`.]]
  268. [[`d = s`] [Assigns to a deque, `d`, from a __forward_sequence__, `s`.]]
  269. [[`__at__<N>(d)`] [The Nth element from the beginning of the sequence; see __at__.]]
  270. ]
  271. [note `__at__<N>(d)` is provided for convenience, despite
  272. `deque` being a __bidirectional_sequence__ only (`at` is supposed to be
  273. a __random_access_sequence__ requirement). The runtime complexity of
  274. __at__ is constant (see __recursive_inline__). `deque` element access
  275. utilizes operator overloading with argument dependent lookup (ADL) of
  276. the proper element getter function given a static constant index
  277. parameter. Interestingly, with modern C++ compilers, this lookup is very
  278. fast and rivals recursive template instantiations in compile time-speed,
  279. so much so that `deque` relies on ADL for all element access (indexing)
  280. as well as iteration.]
  281. [heading Example]
  282. deque<int, float> d(12, 5.5f);
  283. std::cout << __at_c__<0>(d) << std::endl;
  284. std::cout << __at_c__<1>(d) << std::endl;
  285. [endsect]
  286. [section front_extended_deque]
  287. [heading Description]
  288. `front_extended_deque` allows a __deque__ to be front extended. It shares
  289. the same properties as the __deque__.
  290. [heading Header]
  291. See __deque__
  292. [heading Synopsis]
  293. template <typename Deque, typename T>
  294. struct front_extended_deque;
  295. [heading Template parameters]
  296. [table
  297. [[Parameter] [Description] [Default]]
  298. [[`Deque`] [Deque type] [ ]]
  299. [[`T`] [Element type] [ ]]
  300. ]
  301. [note `Deque` can be a __deque__, a __front_extended_deque__ or a
  302. __back_extended_deque__]
  303. [heading Model of]
  304. * __bidirectional_sequence__
  305. [variablelist Notation
  306. [[`D`] [A `front_extended_deque` type]]
  307. [[`e`] [Heterogeneous value]]
  308. [[`N`] [An __mpl_integral_constant__]]
  309. ]
  310. [heading Expression Semantics]
  311. Semantics of an expression is defined only where it differs from, or is
  312. not defined in __bidirectional_sequence__.
  313. [table
  314. [[Expression] [Semantics]]
  315. [[`D(d, e)`] [Extend `d` prepending `e` to its front.]]
  316. [[`__at__<N>(d)`] [The Nth element from the beginning of the sequence; see __at__.]]
  317. ]
  318. [note See __deque__ for further details.]
  319. [heading Example]
  320. typedef deque<int, float> initial_deque;
  321. initial_deque d(12, 5.5f);
  322. front_extended_deque<initial_deque, int> d2(d, 999);
  323. std::cout << __at_c__<0>(d2) << std::endl;
  324. std::cout << __at_c__<1>(d2) << std::endl;
  325. std::cout << __at_c__<2>(d2) << std::endl;
  326. [endsect]
  327. [section back_extended_deque]
  328. [heading Description]
  329. `back_extended_deque` allows a __deque__ to be back extended. It shares
  330. the same properties as the __deque__.
  331. [heading Header]
  332. See __deque__
  333. [heading Synopsis]
  334. template <typename Deque, typename T>
  335. struct back_extended_deque;
  336. [heading Template parameters]
  337. [table
  338. [[Parameter] [Description] [Default]]
  339. [[`Deque`] [Deque type] [ ]]
  340. [[`T`] [Element type] [ ]]
  341. ]
  342. [note `Deque` can be a __deque__, a __back_extended_deque__ or a
  343. __back_extended_deque__]
  344. [heading Model of]
  345. * __bidirectional_sequence__
  346. [variablelist Notation
  347. [[`D`] [A `back_extended_deque` type]]
  348. [[`e`] [Heterogeneous value]]
  349. [[`N`] [An __mpl_integral_constant__]]
  350. ]
  351. [heading Expression Semantics]
  352. Semantics of an expression is defined only where it differs from, or is
  353. not defined in __bidirectional_sequence__.
  354. [table
  355. [[Expression] [Semantics]]
  356. [[`D(d, e)`] [Extend `d` prepending `e` to its back.]]
  357. [[`__at__<N>(d)`] [The Nth element from the beginning of the sequence; see __at__.]]
  358. ]
  359. [note See __deque__ for further details.]
  360. [heading Example]
  361. typedef deque<int, float> initial_deque;
  362. initial_deque d(12, 5.5f);
  363. back_extended_deque<initial_deque, int> d2(d, 999);
  364. std::cout << __at_c__<0>(d2) << std::endl;
  365. std::cout << __at_c__<1>(d2) << std::endl;
  366. std::cout << __at_c__<2>(d2) << std::endl;
  367. [endsect]
  368. [section set]
  369. [heading Description]
  370. set is an __associative_sequence__ of heterogeneous typed data elements.
  371. Type identity is used to impose an equivalence relation on keys. The
  372. element's type is its key. A set may contain at most one element for each
  373. key. Membership testing and element key lookup has constant runtime
  374. complexity (see __overloaded_functions__).
  375. [heading Header]
  376. #include <boost/fusion/container/set.hpp>
  377. #include <boost/fusion/include/set.hpp>
  378. #include <boost/fusion/container/set/set_fwd.hpp>
  379. #include <boost/fusion/include/set_fwd.hpp>
  380. [heading Synopsis]
  381. template <
  382. typename T0 = __unspecified__
  383. , typename T1 = __unspecified__
  384. , typename T2 = __unspecified__
  385. ...
  386. , typename TN = __unspecified__
  387. >
  388. struct set;
  389. For C++11 compilers, the variadic function interface has no upper bound.
  390. For C++03 compilers, the variadic class interface accepts `0` to
  391. `FUSION_MAX_SET_SIZE` elements, where `FUSION_MAX_SET_SIZE` is a user
  392. definable predefined maximum that defaults to `10`. Example:
  393. set<int, char, double>
  394. You may define the preprocessor constant `FUSION_MAX_SET_SIZE` before
  395. including any Fusion header to change the default. Example:
  396. #define FUSION_MAX_SET_SIZE 20
  397. [heading Template parameters]
  398. [table
  399. [[Parameter] [Description] [Default]]
  400. [[`T0`...`TN`] [Element types] [__unspecified__]]
  401. ]
  402. [heading Model of]
  403. * __associative_sequence__
  404. * __forward_sequence__
  405. [variablelist Notation
  406. [[`S`] [A `set` type]]
  407. [[`s`] [An instance of `set`]]
  408. [[`e0`...`en`] [Heterogeneous values]]
  409. [[`fs`] [A __forward_sequence__]]
  410. ]
  411. [heading Expression Semantics]
  412. Semantics of an expression is defined only where it differs from, or is not
  413. defined in __random_access_sequence__ and __associative_sequence__.
  414. [table
  415. [[Expression] [Semantics]]
  416. [[`S()`] [Creates a set with default constructed elements.]]
  417. [[`S(e0, e1,... en)`] [Creates a set with elements `e0`...`en`.]]
  418. [[`S(fs)`] [Copy constructs a set from a __forward_sequence__ `fs`.]]
  419. [[`s = fs`] [Assigns to a set, `s`, from a __forward_sequence__ `fs`.]]
  420. ]
  421. [heading Example]
  422. typedef set<int, float> S;
  423. S s(12, 5.5f);
  424. std::cout << __at_key__<int>(s) << std::endl;
  425. std::cout << __at_key__<float>(s) << std::endl;
  426. std::cout << __result_of_has_key__<S, double>::value << std::endl;
  427. [endsect]
  428. [section map]
  429. [heading Description]
  430. map is an __associative_sequence__ of heterogeneous typed data elements.
  431. Each element is a key/data pair (see __fusion_pair__) where the key has no
  432. data (type only). Type identity is used to impose an equivalence relation
  433. on keys. A map may contain at most one element for each key. Membership
  434. testing and element key lookup has constant runtime complexity (see
  435. __overloaded_functions__).
  436. [heading Header]
  437. #include <boost/fusion/container/map.hpp>
  438. #include <boost/fusion/include/map.hpp>
  439. #include <boost/fusion/container/map/map_fwd.hpp>
  440. #include <boost/fusion/include/map_fwd.hpp>
  441. [heading Synopsis]
  442. template <
  443. typename T0 = __unspecified__
  444. , typename T1 = __unspecified__
  445. , typename T2 = __unspecified__
  446. ...
  447. , typename TN = __unspecified__
  448. >
  449. struct map;
  450. For C++11 compilers, the variadic function interface has no upper bound.
  451. For C++03 compilers, the variadic class interface accepts `0` to
  452. `FUSION_MAX_MAP_SIZE` elements, where `FUSION_MAX_MAP_SIZE` is a user
  453. definable predefined maximum that defaults to `10`. Example:
  454. map<__pair__<int, char>, __pair__<char, char>, __pair__<double, char> >
  455. You may define the preprocessor constant `FUSION_MAX_MAP_SIZE` before
  456. including any Fusion header to change the default. Example:
  457. #define FUSION_MAX_MAP_SIZE 20
  458. [heading Template parameters]
  459. [table
  460. [[Parameter] [Description] [Default]]
  461. [[`T0`...`TN`] [Element types] [__unspecified__]]
  462. ]
  463. [heading Model of]
  464. * __associative_sequence__
  465. * __random_access_sequence__
  466. [variablelist Notation
  467. [[`M`] [A `map` type]]
  468. [[`m`] [An instance of `map`]]
  469. [[`e0`...`en`] [Heterogeneous key/value pairs (see __fusion_pair__)]]
  470. [[`s`] [A __forward_sequence__]]
  471. ]
  472. [heading Expression Semantics]
  473. Semantics of an expression is defined only where it differs from, or is not
  474. defined in __forward_sequence__ and __associative_sequence__.
  475. [table
  476. [[Expression] [Semantics]]
  477. [[`M()`] [Creates a map with default constructed elements.]]
  478. [[`M(e0, e1,... en)`] [Creates a map with element pairs `e0`...`en`.]]
  479. [[`M(s)`] [Copy constructs a map from a __forward_sequence__ `s`.]]
  480. [[`m = s`] [Assigns to a map, `m`, from a __forward_sequence__ `s`.]]
  481. ]
  482. [heading Example]
  483. typedef map<
  484. __pair__<int, char>
  485. , __pair__<double, std::string> >
  486. map_type;
  487. map_type m(
  488. __fusion_make_pair__<int>('X')
  489. , __fusion_make_pair__<double>("Men"));
  490. std::cout << __at_key__<int>(m) << std::endl;
  491. std::cout << __at_key__<double>(m) << std::endl;
  492. [endsect]
  493. [section Generation]
  494. These are the functions that you can use to generate various forms of
  495. __containers__ from elemental values.
  496. [heading Header]
  497. #include <boost/fusion/container/generation.hpp>
  498. #include <boost/fusion/include/generation.hpp>
  499. [section Functions]
  500. [section make_list]
  501. [heading Description]
  502. Create a __list__ from one or more values.
  503. [heading Synopsis]
  504. template <typename T0, typename T1,... typename TN>
  505. typename __result_of_make_list__<T0, T1,... TN>::type
  506. make_list(T0 const& x0, T1 const& x1... TN const& xN);
  507. For C++11 compilers, the variadic function interface has no upper bound.
  508. For C++03 compilers, the variadic function accepts `0` to
  509. `FUSION_MAX_LIST_SIZE` elements, where `FUSION_MAX_LIST_SIZE` is a user
  510. definable predefined maximum that defaults to `10`. You may define the
  511. preprocessor constant `FUSION_MAX_LIST_SIZE` before including any Fusion
  512. header to change the default. Example:
  513. #define FUSION_MAX_LIST_SIZE 20
  514. [heading Parameters]
  515. [table
  516. [[Parameter] [Requirement] [Description]]
  517. [[`x0, x1,... xN`] [Instances of `T0, T1,... TN`] [The arguments to `make_list`]]
  518. ]
  519. [heading Expression Semantics]
  520. make_list(x0, x1,... xN);
  521. [*Return type]: __result_of_make_list__`<T0, T1,... TN>::type`
  522. [*Semantics]: Create a __list__ from `x0, x1,... xN`.
  523. [heading Header]
  524. #include <boost/fusion/container/generation/make_list.hpp>
  525. #include <boost/fusion/include/make_list.hpp>
  526. [heading Example]
  527. make_list(123, "hello", 12.5)
  528. [heading See also]
  529. __note_ref_wrappers__
  530. [endsect]
  531. [section make_cons]
  532. [heading Description]
  533. Create a __cons__ from `car` (/head/) and optional `cdr` (/tail/).
  534. [heading Synopsis]
  535. template <typename Car>
  536. typename __result_of_make_cons__<Car>::type
  537. make_cons(Car const& car);
  538. template <typename Car, typename Cdr>
  539. typename __result_of_make_cons__<Car, Cdr>::type
  540. make_cons(Car const& car, Cdr const& cdr);
  541. [heading Parameters]
  542. [table
  543. [[Parameter] [Requirement] [Description]]
  544. [[`car`] [Instance of `Car`] [The list's head]]
  545. [[`cdr`] [Instance of `Cdr`] [The list's tail (optional)]]
  546. ]
  547. [heading Expression Semantics]
  548. make_cons(car, cdr);
  549. [*Return type]: __result_of_make_cons__`<Car, Cdr>::type` or
  550. __result_of_make_cons__`<Car>::type`
  551. [*Semantics]: Create a __cons__ from `car` (/head/) and optional `cdr` (/tail/).
  552. [heading Header]
  553. #include <boost/fusion/container/generation/make_cons.hpp>
  554. #include <boost/fusion/include/make_cons.hpp>
  555. [heading Example]
  556. make_cons('x', make_cons(123))
  557. [heading See also]
  558. __note_ref_wrappers__
  559. [endsect]
  560. [section make_vector]
  561. [heading Description]
  562. Create a __vector__ from one or more values.
  563. [heading Synopsis]
  564. template <typename T0, typename T1,... typename TN>
  565. typename __result_of_make_vector__<T0, T1,... TN>::type
  566. make_vector(T0 const& x0, T1 const& x1... TN const& xN);
  567. For C++11 compilers, the variadic function interface has no upper bound.
  568. For C++03 compilers, the variadic function accepts `0` to
  569. `FUSION_MAX_VECTOR_SIZE` elements, where `FUSION_MAX_VECTOR_SIZE` is a
  570. user definable predefined maximum that defaults to `10`. You may define
  571. the preprocessor constant `FUSION_MAX_VECTOR_SIZE` before including any
  572. Fusion header to change the default. Example:
  573. #define FUSION_MAX_VECTOR_SIZE 20
  574. [heading Parameters]
  575. [table
  576. [[Parameter] [Requirement] [Description]]
  577. [[`x0, x1,... xN`] [Instances of `T0, T1,... TN`] [The arguments to `make_vector`]]
  578. ]
  579. [heading Expression Semantics]
  580. make_vector(x0, x1,... xN);
  581. [*Return type]: __result_of_make_vector__`<T0, T1,... TN>::type`
  582. [*Semantics]: Create a __vector__ from `x0, x1,... xN`.
  583. [heading Header]
  584. #include <boost/fusion/container/generation/make_vector.hpp>
  585. #include <boost/fusion/include/make_vector.hpp>
  586. [heading Example]
  587. make_vector(123, "hello", 12.5)
  588. [heading See also]
  589. __note_ref_wrappers__
  590. [endsect]
  591. [section make_deque]
  592. [heading Description]
  593. Create a __deque__ from one or more values.
  594. [heading Synopsis]
  595. template <typename ...Elements>
  596. typename __result_of_make_deque__<Elements...>::type
  597. make_deque(Elements const&... elements);
  598. For C++11 compilers, the variadic function interface has no upper bound.
  599. For C++03 compilers, the variadic function accepts `0` to
  600. `FUSION_MAX_DEQUE_SIZE` elements, where `FUSION_MAX_DEQUE_SIZE` is a
  601. user definable predefined maximum that defaults to `10`. You may define
  602. the preprocessor constant `FUSION_MAX_DEQUE_SIZE` before including any
  603. Fusion header to change the default. Example:
  604. #define FUSION_MAX_DEQUE_SIZE 20
  605. [heading Parameters]
  606. [table
  607. [[Parameter] [Description] [Description]]
  608. [[`elements`] [Instances of `Elements`] [The arguments to `make_deque`]]
  609. ]
  610. [heading Expression Semantics]
  611. make_deque(elements...);
  612. [*Return type]: __result_of_make_deque__`<Elements...>::type`
  613. [*Semantics]: Create a __deque__ from `elements...`.
  614. [heading Header]
  615. #include <boost/fusion/container/generation/make_deque.hpp>
  616. #include <boost/fusion/include/make_deque.hpp>
  617. [heading Example]
  618. make_deque(123, "hello", 12.5)
  619. [heading See also]
  620. __note_ref_wrappers__
  621. [endsect]
  622. [section make_set]
  623. [heading Description]
  624. Create a __set__ from one or more values.
  625. [heading Synopsis]
  626. template <typename T0, typename T1,... typename TN>
  627. typename __result_of_make_set__<T0, T1,... TN>::type
  628. make_set(T0 const& x0, T1 const& x1... TN const& xN);
  629. For C++11 compilers, the variadic function interface has no upper bound.
  630. For C++03 compilers, the variadic function accepts `0` to
  631. `FUSION_MAX_SET_SIZE` elements, where `FUSION_MAX_SET_SIZE` is a user
  632. definable predefined maximum that defaults to `10`. You may define the
  633. preprocessor constant `FUSION_MAX_SET_SIZE` before including any Fusion
  634. header to change the default. Example:
  635. #define FUSION_MAX_SET_SIZE 20
  636. [heading Parameters]
  637. [table
  638. [[Parameter] [Requirement] [Description]]
  639. [[`x0, x1,... xN`] [Instances of `T0, T1,... TN`] [The arguments to `make_set`]]
  640. ]
  641. [heading Expression Semantics]
  642. make_set(x0, x1,... xN);
  643. [*Return type]: __result_of_make_set__`<T0, T1,... TN>::type`
  644. [*Semantics]: Create a __set__ from `x0, x1,... xN`.
  645. [*Precondition]: There may be no duplicate key types.
  646. [heading Header]
  647. #include <boost/fusion/container/generation/make_set.hpp>
  648. #include <boost/fusion/include/make_set.hpp>
  649. [heading Example]
  650. make_set(123, "hello", 12.5)
  651. [heading See also]
  652. __note_ref_wrappers__
  653. [endsect]
  654. [section make_map]
  655. [heading Description]
  656. Create a __map__ from one or more key/data pairs.
  657. [heading Synopsis]
  658. template <
  659. typename K0, typename K1,... typename KN
  660. , typename T0, typename T1,... typename TN>
  661. typename __result_of_make_map__<K0, K0,... KN, T0, T1,... TN>::type
  662. make_map(T0 const& x0, T1 const& x1... TN const& xN);
  663. For C++11 compilers, the variadic function interface has no upper bound.
  664. For C++03 compilers, the variadic function accepts `0` to `FUSION_MAX_MAP_SIZE` elements,
  665. where `FUSION_MAX_MAP_SIZE` is a user definable predefined maximum that
  666. defaults to `10`. You may define the preprocessor constant
  667. `FUSION_MAX_MAP_SIZE` before including any Fusion header to change the
  668. default. Example:
  669. #define FUSION_MAX_MAP_SIZE 20
  670. [heading Parameters]
  671. [table
  672. [[Parameter] [Requirement] [Description]]
  673. [[`K0, K1,... KN`] [The key types] [Keys associated with `x0, x1,... xN`]]
  674. [[`x0, x1,... xN`] [Instances of `T0, T1,... TN`] [The arguments to `make_map`]]
  675. ]
  676. [heading Expression Semantics]
  677. make_map<K0, K1,... KN>(x0, x1,... xN);
  678. [*Return type]: __result_of_make_map__`<K0, K0,... KN, T0, T1,... TN>::type`
  679. [*Semantics]: Create a __map__ from `K0, K1,... KN` keys and
  680. `x0, x1,... xN` data.
  681. [*Precondition]: There may be no duplicate key types.
  682. [heading Header]
  683. #include <boost/fusion/container/generation/make_map.hpp>
  684. #include <boost/fusion/include/make_map.hpp>
  685. [heading Example]
  686. make_map<int, double>('X', "Men")
  687. [heading See also]
  688. __note_ref_wrappers__, __fusion_pair__
  689. [endsect]
  690. [section Tiers]
  691. Tiers are sequences, where all elements are non-const reference types. They
  692. are constructed with a call to a couple of /tie/ function templates. The
  693. succeeding sections document the various /tier/ flavors.
  694. * __list_tie__
  695. * __vector_tie__
  696. * __map_tie__
  697. * __deque_tie__
  698. Example:
  699. int i; char c; double d;
  700. ...
  701. __vector_tie__(i, c, d);
  702. The __vector_tie__ function creates a __vector__ of type
  703. `__vector__<int&, char&, double&>`. The same result could be achieved with the call
  704. __make_vector__(__boost_ref_call__(i), __boost_ref_call__(c), __boost_ref_call__(d))
  705. [footnote see __boost_ref__ for details about `ref`].
  706. A /tie/ can be used to 'unpack' another tuple into variables. E.g.:
  707. int i; char c; double d;
  708. __vector_tie__(i, c, d) = __make_vector__(1,'a', 5.5);
  709. std::cout << i << " " << c << " " << d;
  710. This code prints 1 a 5.5 to the standard output stream. A sequence
  711. unpacking operation like this is found for example in ML and Python. It is
  712. convenient when calling functions which return sequences.
  713. [heading Ignore]
  714. There is also an object called /ignore/ which allows you to ignore an
  715. element assigned by a sequence. The idea is that a function may return a
  716. sequence, only part of which you are interested in. For example:
  717. char c;
  718. __vector_tie__(ignore, c) = __make_vector__(1, 'a');
  719. [endsect]
  720. [section list_tie]
  721. [heading Description]
  722. Constructs a tie using a __list__ sequence.
  723. [heading Synopsis]
  724. template <typename T0, typename T1,... typename TN>
  725. __list__<T0&, T1&,... TN&>
  726. list_tie(T0& x0, T1& x1... TN& xN);
  727. For C++11 compilers, the variadic function interface has no upper bound.
  728. For C++03 compilers, the variadic function accepts `0` to
  729. `FUSION_MAX_LIST_SIZE` elements, where `FUSION_MAX_LIST_SIZE` is a user
  730. definable predefined maximum that defaults to `10`. You may define the
  731. preprocessor constant `FUSION_MAX_LIST_SIZE` before including any Fusion
  732. header to change the default. Example:
  733. #define FUSION_MAX_LIST_SIZE 20
  734. [heading Parameters]
  735. [table
  736. [[Parameter] [Requirement] [Description]]
  737. [[`x0, x1,... xN`] [Instances of `T0, T1,... TN`] [The arguments to `list_tie`]]
  738. ]
  739. [heading Expression Semantics]
  740. list_tie(x0, x1,... xN);
  741. [*Return type]: __list__<T0&, T1&,... TN&>
  742. [*Semantics]: Create a __list__ of references from `x0, x1,... xN`.
  743. [heading Header]
  744. #include <boost/fusion/container/generation/list_tie.hpp>
  745. #include <boost/fusion/include/list_tie.hpp>
  746. [heading Example]
  747. int i = 123;
  748. double d = 123.456;
  749. list_tie(i, d)
  750. [endsect]
  751. [section vector_tie]
  752. [heading Description]
  753. Constructs a tie using a __vector__ sequence.
  754. [heading Synopsis]
  755. template <typename T0, typename T1,... typename TN>
  756. __vector__<T0&, T1&,... TN&>
  757. vector_tie(T0& x0, T1& x1... TN& xN);
  758. For C++11 compilers, the variadic function interface has no upper bound.
  759. For C++03 compilers, the variadic function accepts `0` to
  760. `FUSION_MAX_VECTOR_SIZE` elements, where `FUSION_MAX_VECTOR_SIZE` is a
  761. user definable predefined maximum that defaults to `10`. You may define
  762. the preprocessor constant `FUSION_MAX_VECTOR_SIZE` before including any
  763. Fusion header to change the default. Example:
  764. #define FUSION_MAX_VECTOR_SIZE 20
  765. [heading Parameters]
  766. [table
  767. [[Parameter] [Requirement] [Description]]
  768. [[`x0, x1,... xN`] [Instances of `T0, T1,... TN`] [The arguments to `vector_tie`]]
  769. ]
  770. [heading Expression Semantics]
  771. vector_tie(x0, x1,... xN);
  772. [*Return type]: __vector__<T0&, T1&,... TN&>
  773. [*Semantics]: Create a __vector__ of references from `x0, x1,... xN`.
  774. [heading Header]
  775. #include <boost/fusion/container/generation/vector_tie.hpp>
  776. #include <boost/fusion/include/vector_tie.hpp>
  777. [heading Example]
  778. int i = 123;
  779. double d = 123.456;
  780. vector_tie(i, d)
  781. [endsect]
  782. [section map_tie]
  783. [heading Description]
  784. Constructs a tie using a __map__ sequence.
  785. [heading Synopsis]
  786. template <typename K0, typename K1,... typename KN, typename D0, typename D1,... typename DN>
  787. __map__<__pair__<K0, D0&>, __pair__<K1, D1&>,... __pair__<KN, DN&> >
  788. map_tie(D0& d0, D1& d1... DN& dN);
  789. For C++11 compilers, the variadic function interface has no upper bound.
  790. For C++03 compilers, the variadic function accepts `0` to
  791. `FUSION_MAX_MAP_SIZE` elements, where `FUSION_MAX_MAP_SIZE` is a user
  792. definable predefined maximum that defaults to `10`, and a corresponding
  793. number of key types. You may define the preprocessor constant
  794. `FUSION_MAX_MAP_SIZE` before including any Fusion header to change the
  795. default. Example:
  796. #define FUSION_MAX_MAP_SIZE 20
  797. [heading Parameters]
  798. [table
  799. [[Parameter] [Requirement] [Description]]
  800. [[`K0, K1,... KN`] [Any type][The key types associated with each of the `x1,x2,...,xN` values]]
  801. [[`x0, x1,... xN`] [Instances of `T0, T1,... TN`] [The arguments to `map_tie`]]
  802. ]
  803. [heading Expression Semantics]
  804. map_tie<K0, K1,... KN>(x0, x1,... xN);
  805. [*Return type]: __map__<__pair__<K0, D0&>, __pair__<K1, D1&>,... __pair__<KN, DN&> >
  806. [*Semantics]: Create a __map__ of references from `x0, x1,... xN` with keys `K0, K1,... KN`
  807. [heading Header]
  808. #include <boost/fusion/container/generation/map_tie.hpp>
  809. #include <boost/fusion/include/map_tie.hpp>
  810. [heading Example]
  811. struct int_key;
  812. struct double_key;
  813. ...
  814. int i = 123;
  815. double d = 123.456;
  816. map_tie<int_key, double_key>(i, d)
  817. [endsect]
  818. [section deque_tie]
  819. [heading Description]
  820. Constructs a tie using a __deque__ sequence.
  821. [heading Synopsis]
  822. template <typename ...Elements>
  823. __deque__<Elements&...>
  824. deque_tie(Elements&... elements);
  825. For C++11 compilers, the variadic function interface has no upper bound.
  826. For C++03 compilers, the variadic function accepts `0` to
  827. `FUSION_MAX_DEQUE_SIZE` elements, where `FUSION_MAX_DEQUE_SIZE` is a
  828. user definable predefined maximum that defaults to `10`. You may define
  829. the preprocessor constant `FUSION_MAX_DEQUE_SIZE` before including any
  830. Fusion header to change the default. Example:
  831. #define FUSION_MAX_DEQUE_SIZE 20
  832. [heading Parameters]
  833. [table
  834. [[Parameter] [Description] [Description]]
  835. [[`elements`] [Instances of `Elements`] [The arguments to `deque_tie`]]
  836. ]
  837. [heading Expression Semantics]
  838. deque_tie(elements...);
  839. [*Return type]: __deque__<Elements&...>
  840. [*Semantics]: Create a __deque__ of references from `elements...`.
  841. [heading Header]
  842. #include <boost/fusion/container/generation/deque_tie.hpp>
  843. #include <boost/fusion/include/deque_tie.hpp>
  844. [heading Example]
  845. int i = 123;
  846. double d = 123.456;
  847. deque_tie(i, d)
  848. [endsect]
  849. [endsect]
  850. [section MetaFunctions]
  851. [section make_list]
  852. [heading Description]
  853. Returns the result type of __make_list__.
  854. [heading Synopsis]
  855. template <typename T0, typename T1,... typename TN>
  856. struct make_list;
  857. For C++11 compilers, the variadic function interface has no upper bound.
  858. For C++03 compilers, the variadic function accepts `0` to
  859. `FUSION_MAX_LIST_SIZE` elements, where `FUSION_MAX_LIST_SIZE` is a user
  860. definable predefined maximum that defaults to `10`. You may define the
  861. preprocessor constant `FUSION_MAX_LIST_SIZE` before including any Fusion
  862. header to change the default. Example:
  863. #define FUSION_MAX_LIST_SIZE 20
  864. [heading Parameters]
  865. [table
  866. [[Parameter] [Requirement] [Description]]
  867. [[`T0, T1,... TN`] [Any type] [Template arguments to `make_list`]]
  868. ]
  869. [heading Expression Semantics]
  870. result_of::make_list<T0, T1,... TN>::type
  871. [*Return type]: A __list__ with elements of types converted following the
  872. rules for __element_conversion__.
  873. [*Semantics]: Create a __list__ from `T0, T1,... TN`.
  874. [heading Header]
  875. #include <boost/fusion/container/generation/make_list.hpp>
  876. #include <boost/fusion/include/make_list.hpp>
  877. [heading Example]
  878. result_of::make_list<int, const char(&)[7], double>::type
  879. [endsect]
  880. [section make_cons]
  881. [heading Description]
  882. Returns the result type of __make_cons__.
  883. [heading Synopsis]
  884. template <typename Car, typename Cdr = nil>
  885. struct make_cons;
  886. [heading Parameters]
  887. [table
  888. [[Parameter] [Requirement] [Description]]
  889. [[`Car`] [Any type] [The list's head type]]
  890. [[`Cdr`] [A `cons`] [The list's tail type (optional)]]
  891. ]
  892. [heading Expression Semantics]
  893. result_of::make_cons<Car, Cdr>::type
  894. [*Return type]: A __cons__ with head element, `Car`, of type converted
  895. following the rules for __element_conversion__, and tail, `Cdr`.
  896. [*Semantics]: Create a __cons__ from `Car` (/head/) and optional `Cdr` (/tail/).
  897. [heading Header]
  898. #include <boost/fusion/container/generation/make_cons.hpp>
  899. #include <boost/fusion/include/make_cons.hpp>
  900. [heading Example]
  901. result_of::make_cons<char, result_of::make_cons<int>::type>::type
  902. [endsect]
  903. [section make_vector]
  904. [heading Description]
  905. Returns the result type of __make_vector__.
  906. [heading Synopsis]
  907. template <typename T0, typename T1,... typename TN>
  908. struct make_vector;
  909. For C++11 compilers, the variadic function interface has no upper bound.
  910. For C++03 compilers, the variadic function accepts `0` to
  911. `FUSION_MAX_VECTOR_SIZE` elements, where `FUSION_MAX_VECTOR_SIZE` is a user
  912. definable predefined maximum that defaults to `10`. You may define the
  913. preprocessor constant `FUSION_MAX_VECTOR_SIZE` before including any Fusion
  914. header to change the default. Example:
  915. #define FUSION_MAX_VECTOR_SIZE 20
  916. [heading Parameters]
  917. [table
  918. [[Parameter] [Requirement] [Description]]
  919. [[`T0, T1,... TN`] [Any type] [Template arguments to `make_vector`]]
  920. ]
  921. [heading Expression Semantics]
  922. result_of::make_vector<T0, T1,... TN>::type
  923. [*Return type]: A __vector__ with elements of types converted following the
  924. rules for __element_conversion__.
  925. [*Semantics]: Create a __vector__ from `T0, T1,... TN`.
  926. [heading Header]
  927. #include <boost/fusion/container/generation/make_vector.hpp>
  928. #include <boost/fusion/include/make_vector.hpp>
  929. [heading Example]
  930. result_of::make_vector<int, const char(&)[7], double>::type
  931. [endsect]
  932. [section make_deque]
  933. [heading Description]
  934. Returns the result type of __make_deque__.
  935. [heading Synopsis]
  936. template <typename ...Elements>
  937. struct make_deque;
  938. For C++11 compilers, the variadic template interface has no upper bound.
  939. For C++03 The variadic function accepts `0` to `FUSION_MAX_DEQUE_SIZE`
  940. elements, where `FUSION_MAX_DEQUE_SIZE` is a user definable predefined
  941. maximum that defaults to `10`. You may define the preprocessor constant
  942. `FUSION_MAX_DEQUE_SIZE` before including any Fusion header to change the
  943. default. Example:
  944. #define FUSION_MAX_DEQUE_SIZE 20
  945. [heading Parameters]
  946. [table
  947. [[Parameter] [Requirement] [Description]]
  948. [[`Elements`] [Variadic template types] [Template arguments to `make_deque`]]
  949. ]
  950. [heading Expression Semantics]
  951. result_of::make_deque<Elements...>::type
  952. [*Return type]: A __deque__ with elements of types converted following the
  953. rules for __element_conversion__.
  954. [*Semantics]: Create a __deque__ from `Elements...`.
  955. [heading Header]
  956. #include <boost/fusion/container/generation/make_deque.hpp>
  957. #include <boost/fusion/include/make_deque.hpp>
  958. [heading Example]
  959. result_of::make_deque<int, const char(&)[7], double>::type
  960. [endsect]
  961. [section make_set]
  962. [heading Description]
  963. Returns the result type of __make_set__.
  964. [heading Synopsis]
  965. template <typename T0, typename T1,... typename TN>
  966. struct make_set;
  967. For C++11 compilers, the variadic function interface has no upper bound.
  968. For C++03 compilers, the variadic function accepts `0` to
  969. `FUSION_MAX_SET_SIZE` elements, where `FUSION_MAX_SET_SIZE` is a user definable
  970. predefined maximum that defaults to `10`. You may define the preprocessor
  971. constant `FUSION_MAX_SET_SIZE` before including any Fusion header to change
  972. the default. Example:
  973. #define FUSION_MAX_SET_SIZE 20
  974. [heading Parameters]
  975. [table
  976. [[Parameter] [Requirement] [Description]]
  977. [[`T0, T1,... TN`] [Any type] [The arguments to `make_set`]]
  978. ]
  979. [heading Expression Semantics]
  980. result_of::make_set<T0, T1,... TN>::type
  981. [*Return type]: A __set__ with elements of types converted following the
  982. rules for __element_conversion__.
  983. [*Semantics]: Create a __set__ from `T0, T1,... TN`.
  984. [*Precondition]: There may be no duplicate key types.
  985. [heading Header]
  986. #include <boost/fusion/container/generation/make_set.hpp>
  987. #include <boost/fusion/include/make_set.hpp>
  988. [heading Example]
  989. result_of::make_set<int, char, double>::type
  990. [endsect]
  991. [section make_map]
  992. [heading Description]
  993. Returns the result type of __make_map__.
  994. The implementation depends on the support of variadic templates.
  995. When variadic templates are not supported, make_map is a metafunction of the form:
  996. [heading Synopsis]
  997. template <
  998. typename K0, typename K1,... typename KN
  999. , typename T0, typename T1,... typename TN>
  1000. struct make_map;
  1001. For C++11 compilers, the variadic function interface has no upper bound.
  1002. For C++03 compilers, the variadic function accepts `0` to `FUSION_MAX_MAP_SIZE` elements,
  1003. where `FUSION_MAX_MAP_SIZE` is a user definable predefined maximum that
  1004. defaults to `10`. You may define the preprocessor constant
  1005. `FUSION_MAX_MAP_SIZE` before including any Fusion header to change the
  1006. default. Example:
  1007. #define FUSION_MAX_MAP_SIZE 20
  1008. When variadic templates are supported, make_map is a metafunction class of the form:
  1009. [heading Synopsis]
  1010. template <
  1011. typename K0, typename K1,... typename KN>
  1012. struct make_map
  1013. {
  1014. struct apply<
  1015. typename T0, typename T1,... typename TN>
  1016. };
  1017. [heading Parameters]
  1018. [table
  1019. [[Parameter] [Requirement] [Description]]
  1020. [[`K0, K1,... KN`] [Any type] [Keys associated with `T0, T1,... TN`]]
  1021. [[`T0, T1,... TN`] [Any type] [Data associated with keys `K0, K1,... KN`]]
  1022. ]
  1023. [heading Expression Semantics]
  1024. #if !defined(BOOST_FUSION_HAS_VARIADIC_MAP)
  1025. resulf_of::make_map<K0, K1,... KN, T0, T1,... TN>::type;
  1026. #else
  1027. resulf_of::make_map<K0, K1,... KN>::apply<T0, T1,... TN>::type;
  1028. #endif
  1029. [*Return type]: __result_of_make_map__`<K0, K0,... KN, T0, T1,... TN>::type`
  1030. when variadic templates are not supported, or
  1031. __result_of_make_map__`<K0, K0,... KN>::apply<T0, T1,... TN>::type`
  1032. when variadic templates are supported.
  1033. [*Semantics]: A __map__ with __fusion_pair__ elements where the
  1034. `second_type` is converted following the rules for __element_conversion__.
  1035. [*Precondition]: There may be no duplicate key types.
  1036. [heading Header]
  1037. #include <boost/fusion/container/generation/make_map.hpp>
  1038. #include <boost/fusion/include/make_map.hpp>
  1039. [heading Example]
  1040. #if !defined(BOOST_FUSION_HAS_VARIADIC_MAP)
  1041. result_of::make_map<int, double, char, double>::type
  1042. #else
  1043. result_of::make_map<int, double>::apply<char, double>::type
  1044. #endif
  1045. [heading See also]
  1046. __fusion_pair__
  1047. [endsect]
  1048. [section list_tie]
  1049. [heading Description]
  1050. Returns the result type of __list_tie__.
  1051. [heading Synopsis]
  1052. template <typename T0, typename T1,... typename TN>
  1053. struct list_tie;
  1054. For C++11 compilers, the variadic function interface has no upper bound.
  1055. For C++03 compilers, the variadic function accepts `0` to
  1056. `FUSION_MAX_LIST_SIZE` elements, where `FUSION_MAX_LIST_SIZE` is a user
  1057. definable predefined maximum that defaults to `10`. You may define the
  1058. preprocessor constant `FUSION_MAX_LIST_SIZE` before including any Fusion
  1059. header to change the default. Example:
  1060. #define FUSION_MAX_LIST_SIZE 20
  1061. [heading Parameters]
  1062. [table
  1063. [[Parameter] [Requirement] [Description]]
  1064. [[`T0, T1,... TN`] [Any type] [The arguments to `list_tie`]]
  1065. ]
  1066. [heading Expression Semantics]
  1067. result_of::list_tie<T0, T1,... TN>::type;
  1068. [*Return type]: __list__<T0&, T1&,... TN&>
  1069. [*Semantics]: Create a __list__ of references from `T0, T1,... TN`.
  1070. [heading Header]
  1071. #include <boost/fusion/container/generation/list_tie.hpp>
  1072. #include <boost/fusion/include/list_tie.hpp>
  1073. [heading Example]
  1074. result_of::list_tie<int, double>::type
  1075. [endsect]
  1076. [section vector_tie]
  1077. [heading Description]
  1078. Returns the result type of __vector_tie__.
  1079. [heading Synopsis]
  1080. template <typename T0, typename T1,... typename TN>
  1081. struct vector_tie;
  1082. For C++11 compilers, the variadic function interface has no upper bound.
  1083. For C++03 compilers, the variadic function accepts `0` to
  1084. `FUSION_MAX_VECTOR_SIZE` elements, where `FUSION_MAX_VECTOR_SIZE` is a user
  1085. definable predefined maximum that defaults to `10`. You may define the
  1086. preprocessor constant `FUSION_MAX_VECTOR_SIZE` before including any Fusion
  1087. header to change the default. Example:
  1088. #define FUSION_MAX_VECTOR_SIZE 20
  1089. [heading Parameters]
  1090. [table
  1091. [[Parameter] [Requirement] [Description]]
  1092. [[`T0, T1,... TN`] [Any type] [The arguments to `vector_tie`]]
  1093. ]
  1094. [heading Expression Semantics]
  1095. result_of::vector_tie<T0, T1,... TN>::type;
  1096. [*Return type]: __vector__<T0&, T1&,... TN&>
  1097. [*Semantics]: Create a __vector__ of references from `T0, T1,... TN`.
  1098. [heading Header]
  1099. #include <boost/fusion/container/generation/vector_tie.hpp>
  1100. #include <boost/fusion/include/vector_tie.hpp>
  1101. [heading Example]
  1102. result_of::vector_tie<int, double>::type
  1103. [endsect]
  1104. [section deque_tie]
  1105. [heading Description]
  1106. Returns the result type of __deque_tie__.
  1107. [heading Synopsis]
  1108. template <typename ...Elements>
  1109. struct deque_tie;
  1110. For C++11 compilers, the variadic template interface has no upper bound.
  1111. For C++03 compilers, the variadic function accepts `0` to
  1112. `FUSION_MAX_DEQUE_SIZE` elements, where `FUSION_MAX_DEQUE_SIZE` is a
  1113. user definable predefined maximum that defaults to `10`. You may define
  1114. the preprocessor constant `FUSION_MAX_DEQUE_SIZE` before including any
  1115. Fusion header to change the default. Example:
  1116. #define FUSION_MAX_DEQUE_SIZE 20
  1117. [heading Parameters]
  1118. [table
  1119. [[Parameter] [Requirement] [Description]]
  1120. [[`Elements`] [Variadic template types] [Template arguments to `deque_tie`]]
  1121. ]
  1122. [heading Expression Semantics]
  1123. result_of::deque_tie<Elements...>::type;
  1124. [*Return type]: __deque__<Elements&...>
  1125. [*Semantics]: Create a __deque__ of references from `Elements...`.
  1126. [heading Header]
  1127. #include <boost/fusion/container/generation/deque_tie.hpp>
  1128. #include <boost/fusion/include/deque_tie.hpp>
  1129. [heading Example]
  1130. result_of::deque_tie<int, double>::type
  1131. [endsect]
  1132. [section map_tie]
  1133. [heading Description]
  1134. Returns the result type of __map_tie__.
  1135. [heading Synopsis]
  1136. template <typename K0, typename K1,... typename KN, typename D0, typename D1,... typename DN>
  1137. struct map_tie;
  1138. For C++11 compilers, the variadic function interface has no upper bound.
  1139. For C++03 compilers, the variadic function accepts `0` to
  1140. `FUSION_MAX_MAP_SIZE` elements, where `FUSION_MAX_MAP_SIZE` is a user definable
  1141. predefined maximum that defaults to `10`. You may define the preprocessor
  1142. constant `FUSION_MAX_MAP_SIZE` before including any Fusion header to change
  1143. the default. Example:
  1144. #define FUSION_MAX_MAP_SIZE 20
  1145. [heading Parameters]
  1146. [table
  1147. [[Parameter] [Requirement] [Description]]
  1148. [[`K0, K1,... KN`] [Any type] [The key types for `map_tie`]]
  1149. [[`D0, D1,... DN`] [Any type] [The arguments types for `map_tie`]]
  1150. ]
  1151. [heading Expression Semantics]
  1152. result_of::map_tie<K0, K1,... KN, D0, D1,... DN>::type;
  1153. [*Return type]: __map__<__pair__<K0, D0&>, __pair__<K1, D1&>,... __pair__<KN, DN&> >
  1154. [*Semantics]: Create a __map__ of references from `D0, D1,... DN` with keys `K0, K1,... KN`
  1155. [heading Header]
  1156. #include <boost/fusion/container/generation/map_tie.hpp>
  1157. #include <boost/fusion/include/map_tie.hpp>
  1158. [heading Example]
  1159. struct int_key;
  1160. struct double_key;
  1161. ...
  1162. result_of::map_tie<int_key, double_key, int, double>::type
  1163. [endsect]
  1164. [endsect]
  1165. [endsect]
  1166. [section Conversion]
  1167. All fusion sequences can be converted to one of the __containers__ types
  1168. using one of these conversion functions.
  1169. [heading Header]
  1170. #include <boost/fusion/include/convert.hpp>
  1171. [section Functions]
  1172. [section as_list]
  1173. [heading Description]
  1174. Convert a fusion sequence to a __list__.
  1175. [heading Synopsis]
  1176. template <typename Sequence>
  1177. typename result_of::as_list<Sequence>::type
  1178. as_list(Sequence& seq);
  1179. template <typename Sequence>
  1180. typename result_of::as_list<Sequence const>::type
  1181. as_list(Sequence const& seq);
  1182. [heading Parameters]
  1183. [table
  1184. [[Parameter] [Requirement] [Description]]
  1185. [[`seq`] [An instance of Sequence] [The sequence to convert.]]
  1186. ]
  1187. [heading Expression Semantics]
  1188. as_list(seq);
  1189. [*Return type]: __result_of_as_list__`<Sequence>::type`
  1190. [*Semantics]: Convert a fusion sequence, `seq`, to a __list__.
  1191. [heading Header]
  1192. #include <boost/fusion/container/list/convert.hpp>
  1193. #include <boost/fusion/include/as_list.hpp>
  1194. [heading Example]
  1195. as_list(__make_vector__('x', 123, "hello"))
  1196. [endsect]
  1197. [section as_vector]
  1198. [heading Description]
  1199. Convert a fusion sequence to a __vector__.
  1200. [heading Synopsis]
  1201. template <typename Sequence>
  1202. typename result_of::as_vector<Sequence>::type
  1203. as_vector(Sequence& seq);
  1204. template <typename Sequence>
  1205. typename result_of::as_vector<Sequence const>::type
  1206. as_vector(Sequence const& seq);
  1207. [heading Parameters]
  1208. [table
  1209. [[Parameter] [Requirement] [Description]]
  1210. [[`seq`] [An instance of Sequence] [The sequence to convert.]]
  1211. ]
  1212. [heading Expression Semantics]
  1213. as_vector(seq);
  1214. [*Return type]: __result_of_as_vector__`<Sequence>::type`
  1215. [*Semantics]: Convert a fusion sequence, `seq`, to a __vector__.
  1216. [heading Header]
  1217. #include <boost/fusion/container/vector/convert.hpp>
  1218. #include <boost/fusion/include/as_vector.hpp>
  1219. [heading Example]
  1220. as_vector(__make_list__('x', 123, "hello"))
  1221. [endsect]
  1222. [section as_deque]
  1223. [heading Description]
  1224. Convert a fusion sequence to a __deque__.
  1225. [heading Synopsis]
  1226. template <typename Sequence>
  1227. typename result_of::as_deque<Sequence>::type
  1228. as_deque(Sequence& seq);
  1229. template <typename Sequence>
  1230. typename result_of::as_deque<Sequence const>::type
  1231. as_deque(Sequence const& seq);
  1232. [heading Parameters]
  1233. [table
  1234. [[Parameter] [Requirement] [Description]]
  1235. [[`seq`] [An instance of Sequence] [The sequence to convert.]]
  1236. ]
  1237. [heading Expression Semantics]
  1238. as_deque(seq);
  1239. [*Return type]: __result_of_as_deque__`<Sequence>::type`
  1240. [*Semantics]: Convert a fusion sequence, `seq`, to a __deque__.
  1241. [heading Header]
  1242. #include <boost/fusion/container/deque/convert.hpp>
  1243. #include <boost/fusion/include/as_deque.hpp>
  1244. [heading Example]
  1245. as_deque(__make_vector__('x', 123, "hello"))
  1246. [endsect]
  1247. [section as_set]
  1248. [heading Description]
  1249. Convert a fusion sequence to a __set__.
  1250. [heading Synopsis]
  1251. template <typename Sequence>
  1252. typename result_of::as_set<Sequence>::type
  1253. as_set(Sequence& seq);
  1254. template <typename Sequence>
  1255. typename result_of::as_set<Sequence const>::type
  1256. as_set(Sequence const& seq);
  1257. [heading Parameters]
  1258. [table
  1259. [[Parameter] [Requirement] [Description]]
  1260. [[`seq`] [An instance of Sequence] [The sequence to convert.]]
  1261. ]
  1262. [heading Expression Semantics]
  1263. as_set(seq);
  1264. [*Return type]: __result_of_as_set__`<Sequence>::type`
  1265. [*Semantics]: Convert a fusion sequence, `seq`, to a __set__.
  1266. [*Precondition]: There may be no duplicate key types.
  1267. [heading Header]
  1268. #include <boost/fusion/container/set/convert.hpp>
  1269. #include <boost/fusion/include/as_set.hpp>
  1270. [heading Example]
  1271. as_set(__make_vector__('x', 123, "hello"))
  1272. [endsect]
  1273. [section as_map]
  1274. [heading Description]
  1275. Convert a fusion sequence to a __map__.
  1276. [heading Synopsis]
  1277. template <typename Sequence>
  1278. typename result_of::as_map<Sequence>::type
  1279. as_map(Sequence& seq);
  1280. template <typename Sequence>
  1281. typename result_of::as_map<Sequence const>::type
  1282. as_map(Sequence const& seq);
  1283. [heading Parameters]
  1284. [table
  1285. [[Parameter] [Requirement] [Description]]
  1286. [[`seq`] [An instance of Sequence] [The sequence to convert.]]
  1287. ]
  1288. [heading Expression Semantics]
  1289. as_map(seq);
  1290. [*Return type]: __result_of_as_map__`<Sequence>::type`
  1291. [*Semantics]: Convert a fusion sequence, `seq`, to a __map__.
  1292. [*Precondition]: For non-associative sequence, the elements are assumed to be
  1293. __fusion_pair__s. There may be no duplicate __fusion_pair__ key types.
  1294. [heading Header]
  1295. #include <boost/fusion/container/map/convert.hpp>
  1296. #include <boost/fusion/include/as_map.hpp>
  1297. [heading Example]
  1298. // from sequence of __fusion_pair__
  1299. as_map(__make_vector__(
  1300. __fusion_make_pair__<int>('X')
  1301. , __fusion_make_pair__<double>("Men")))
  1302. // from associative sequence
  1303. namespace ns
  1304. {
  1305. struct x_member;
  1306. struct y_member;
  1307. }
  1308. BOOST_FUSION_DEFINE_ASSOC_STRUCT(
  1309. (ns),
  1310. point,
  1311. (int, x, ns::x_member)
  1312. (int, y, ns::y_member)
  1313. )
  1314. ...
  1315. as_map(ns::point(123, 456))
  1316. [endsect]
  1317. [endsect]
  1318. [section Metafunctions]
  1319. [section as_list]
  1320. [heading Description]
  1321. Returns the result type of __as_list__.
  1322. [heading Synopsis]
  1323. template <typename Sequence>
  1324. struct as_list;
  1325. [heading Parameters]
  1326. [table
  1327. [[Parameter] [Requirement] [Description]]
  1328. [[`Sequence`] [A fusion __sequence__] [The sequence type to convert.]]
  1329. ]
  1330. [heading Expression Semantics]
  1331. result_of::as_list<Sequence>::type;
  1332. [*Return type]: A __list__ with same elements as the input sequence,
  1333. `Sequence`.
  1334. [*Semantics]: Convert a fusion sequence, `Sequence`, to a __list__.
  1335. [heading Header]
  1336. #include <boost/fusion/container/list/convert.hpp>
  1337. #include <boost/fusion/include/as_list.hpp>
  1338. [heading Example]
  1339. result_of::as_list<__vector__<char, int> >::type
  1340. [endsect]
  1341. [section as_vector]
  1342. [heading Description]
  1343. Returns the result type of __as_vector__.
  1344. [heading Synopsis]
  1345. template <typename Sequence>
  1346. struct as_vector;
  1347. [heading Parameters]
  1348. [table
  1349. [[Parameter] [Requirement] [Description]]
  1350. [[`Sequence`] [A fusion __sequence__] [The sequence to convert.]]
  1351. ]
  1352. [heading Expression Semantics]
  1353. result_of::as_vector<Sequence>::type;
  1354. [*Return type]: A __vector__ with same elements as the input sequence,
  1355. `Sequence`.
  1356. [*Semantics]: Convert a fusion sequence, `Sequence`, to a __vector__.
  1357. [heading Header]
  1358. #include <boost/fusion/container/vector/convert.hpp>
  1359. #include <boost/fusion/include/as_vector.hpp>
  1360. [heading Example]
  1361. result_of::as_vector<__list__<char, int> >::type
  1362. [endsect]
  1363. [section as_deque]
  1364. [heading Description]
  1365. Returns the result type of __as_deque__.
  1366. [heading Synopsis]
  1367. template <typename Sequence>
  1368. struct as_deque;
  1369. [heading Parameters]
  1370. [table
  1371. [[Parameter] [Requirement] [Description]]
  1372. [[`Sequence`] [A fusion __sequence__] [The sequence type to convert.]]
  1373. ]
  1374. [heading Expression Semantics]
  1375. result_of::as_deque<Sequence>::type;
  1376. [*Return type]: A __deque__ with same elements as the input sequence,
  1377. `Sequence`.
  1378. [*Semantics]: Convert a fusion sequence, `Sequence`, to a __deque__.
  1379. [heading Header]
  1380. #include <boost/fusion/container/deque/convert.hpp>
  1381. #include <boost/fusion/include/as_deque.hpp>
  1382. [heading Example]
  1383. result_of::as_deque<__vector__<char, int> >::type
  1384. [endsect]
  1385. [section as_set]
  1386. [heading Description]
  1387. Returns the result type of __as_set__.
  1388. [heading Synopsis]
  1389. template <typename Sequence>
  1390. struct as_set;
  1391. [heading Parameters]
  1392. [table
  1393. [[Parameter] [Requirement] [Description]]
  1394. [[`Sequence`] [A fusion __sequence__] [The sequence to convert.]]
  1395. ]
  1396. [heading Expression Semantics]
  1397. result_of::as_set<Sequence>::type;
  1398. [*Return type]: A __set__ with same elements as the input sequence,
  1399. `Sequence`.
  1400. [*Semantics]: Convert a fusion sequence, `Sequence`, to a __set__.
  1401. [*Precondition]: There may be no duplicate key types.
  1402. [heading Header]
  1403. #include <boost/fusion/container/set/convert.hpp>
  1404. #include <boost/fusion/include/as_set.hpp>
  1405. [heading Example]
  1406. result_of::as_set<__vector__<char, int> >::type
  1407. [endsect]
  1408. [section as_map]
  1409. [heading Description]
  1410. Returns the result type of __as_map__.
  1411. [heading Synopsis]
  1412. template <typename Sequence>
  1413. struct as_map;
  1414. [heading Parameters]
  1415. [table
  1416. [[Parameter] [Requirement] [Description]]
  1417. [[`Sequence`] [A fusion __sequence__] [The sequence to convert.]]
  1418. ]
  1419. [heading Expression Semantics]
  1420. result_of::as_map<Sequence>::type;
  1421. [*Return type]: A __map__ with same elements as the input sequence,
  1422. `Sequence`.
  1423. [*Semantics]: Convert a fusion sequence, `Sequence`, to a __map__.
  1424. [*Precondition]: For non-associative sequence, the elements are assumed to be
  1425. __fusion_pair__s. There may be no duplicate __fusion_pair__ key types.
  1426. [heading Header]
  1427. #include <boost/fusion/container/map/convert.hpp>
  1428. #include <boost/fusion/include/as_map.hpp>
  1429. [heading Example]
  1430. // from sequence of __fusion_pair__
  1431. result_of::as_map<__vector__<
  1432. __fusion_pair__<int, char>
  1433. , __fusion_pair__<double, std::string> > >::type
  1434. // from associative sequence
  1435. namespace ns
  1436. {
  1437. struct x_member;
  1438. struct y_member;
  1439. }
  1440. BOOST_FUSION_DEFINE_ASSOC_STRUCT(
  1441. (ns),
  1442. point,
  1443. (int, x, ns::x_member)
  1444. (int, y, ns::y_member)
  1445. )
  1446. ...
  1447. result_of::as_map<ns::point>::type // __map__<__fusion_pair__<ns::x_member, int>, __fusion_pair__<ns::y_member, int> >
  1448. [endsect]
  1449. [endsect]
  1450. [endsect]
  1451. [endsect]