]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/fusion/doc/container.qbk
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / fusion / doc / container.qbk
1 [/==============================================================================
2 Copyright (C) 2001-2011 Joel de Guzman
3 Copyright (C) 2006 Dan Marsden
4
5 Use, modification and distribution is subject to the Boost Software
6 License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
7 http://www.boost.org/LICENSE_1_0.txt)
8 ===============================================================================/]
9 [section Container]
10
11 Fusion provides a few predefined sequences out of the box. These
12 /containers/ actually hold heterogeneously typed data; unlike
13 __views__. These containers are more or less counterparts of those in __stl__.
14
15 [heading Header]
16
17 #include <boost/fusion/container.hpp>
18 #include <boost/fusion/include/container.hpp>
19
20 [section vector]
21
22 [heading Description]
23
24 `vector` is a __random_access_sequence__ of heterogeneous typed data
25 structured as a simple `struct` where each element is held as a member
26 variable. `vector` is the simplest of the Fusion sequence container (a
27 vector with N elements is just a struct with N members), and in many
28 cases the most efficient.
29
30 [heading Header]
31
32 #include <boost/fusion/container/vector.hpp>
33 #include <boost/fusion/include/vector.hpp>
34 #include <boost/fusion/container/vector/vector_fwd.hpp>
35 #include <boost/fusion/include/vector_fwd.hpp>
36
37 // numbered forms
38 #include <boost/fusion/container/vector/vector10.hpp>
39 #include <boost/fusion/include/vector10.hpp>
40 #include <boost/fusion/container/vector/vector20.hpp>
41 #include <boost/fusion/include/vector20.hpp>
42 #include <boost/fusion/container/vector/vector30.hpp>
43 #include <boost/fusion/include/vector30.hpp>
44 #include <boost/fusion/container/vector/vector40.hpp>
45 #include <boost/fusion/include/vector40.hpp>
46 #include <boost/fusion/container/vector/vector50.hpp>
47 #include <boost/fusion/include/vector50.hpp>
48
49 [heading Synopsis]
50
51 [*Numbered forms]
52
53 struct vector0;
54
55 template <typename T0>
56 struct vector1;
57
58 template <typename T0, typename T1>
59 struct vector2;
60
61 template <typename T0, typename T1, typename T2>
62 struct vector3;
63
64 ...
65
66 template <typename T0, typename T1, typename T2..., typename TN>
67 struct vectorN;
68
69 [important Numbered forms will be deprecated in C++11 and it will be provided
70 via aliasing templates. It means that your partial specialization
71 might be compile error. You can detect whether it is aliasing
72 templates or not, using `BOOST_FUSION_HAS_VARIADIC_VECTOR`.]
73
74 [*Variadic form]
75
76 template <
77 typename T0 = __unspecified__
78 , typename T1 = __unspecified__
79 , typename T2 = __unspecified__
80 ...
81 , typename TN = __unspecified__
82 >
83 struct vector;
84
85 The numbered form accepts the exact number of elements. Example:
86
87 vector3<int, char, double>
88
89 For C++11 compilers, the variadic function interface has no upper bound.
90
91 For C++03 compilers, the The variadic form accepts `0` to
92 `FUSION_MAX_VECTOR_SIZE` elements, where `FUSION_MAX_VECTOR_SIZE` is a
93 user definable predefined maximum that defaults to `10`. Example:
94
95 vector<int, char, double>
96
97 You may define the preprocessor constant `FUSION_MAX_VECTOR_SIZE` before
98 including any Fusion header to change the default. Example:
99
100 #define FUSION_MAX_VECTOR_SIZE 20
101
102 [heading Template parameters]
103
104 [table
105 [[Parameter] [Description] [Default]]
106 [[`T0`...`TN`] [Element types] [__unspecified__]]
107 ]
108
109 [heading Model of]
110
111 * __random_access_sequence__
112
113 [variablelist Notation
114 [[`v`] [Instance of `vector`]]
115 [[`V`] [A `vector` type]]
116 [[`e0`...`en`] [Heterogeneous values]]
117 [[`s`] [A __forward_sequence__]]
118 ]
119
120 [heading Expression Semantics]
121
122 Semantics of an expression is defined only where it differs from, or is not
123 defined in __random_access_sequence__.
124
125 [table
126 [[Expression] [Semantics]]
127 [[`V()`] [Creates a vector with default constructed elements.]]
128 [[`V(e0, e1,... en)`] [Creates a vector with elements `e0`...`en`.]]
129 [[`V(s)`] [Copy constructs a vector from a __forward_sequence__, `s`.]]
130 [[`v = s`] [Assigns to a vector, `v`, from a __forward_sequence__, `s`.]]
131 ]
132
133 [heading Example]
134
135 vector<int, float> v(12, 5.5f);
136 std::cout << __at_c__<0>(v) << std::endl;
137 std::cout << __at_c__<1>(v) << std::endl;
138
139 [endsect]
140
141 [section cons]
142
143 [heading Description]
144
145 `cons` is a simple __forward_sequence__. It is a lisp style recursive list
146 structure where `car` is the /head/ and `cdr` is the /tail/: usually
147 another cons structure or `nil`: the empty list. Fusion's __list__ is built
148 on top of this more primitive data structure. It is more efficient than
149 __vector__ when the target sequence is constructed piecemeal (a data at a
150 time). The runtime cost of access to each element is peculiarly constant
151 (see __recursive_inline__).
152
153 [heading Header]
154
155 #include <boost/fusion/container/list/cons.hpp>
156 #include <boost/fusion/include/cons.hpp>
157
158 [heading Synopsis]
159
160 template <typename Car, typename Cdr = nil>
161 struct cons;
162
163 [heading Template parameters]
164
165 [table
166 [[Parameter] [Description] [Default]]
167 [[`Car`] [Head type] [ ]]
168 [[`Cdr`] [Tail type] [`nil`]]
169 ]
170
171 [heading Model of]
172
173 * __forward_sequence__
174
175 [variablelist Notation
176 [[`nil`] [An empty `cons`]]
177 [[`C`] [A `cons` type]]
178 [[`l`, `l2`] [Instances of `cons`]]
179 [[`car`] [An arbitrary data]]
180 [[`cdr`] [Another `cons` list]]
181 [[`s`] [A __forward_sequence__]]
182 [[`N`] [An __mpl_integral_constant__]]
183 ]
184
185 [heading Expression Semantics]
186
187 Semantics of an expression is defined only where it differs from, or is not
188 defined in __forward_sequence__.
189
190 [table
191 [[Expression] [Semantics]]
192 [[`nil()`] [Creates an empty list.]]
193 [[`C()`] [Creates a cons with default constructed elements.]]
194 [[`C(car)`] [Creates a cons with `car` head and default constructed tail.]]
195 [[`C(car, cdr)`] [Creates a cons with `car` head and `cdr` tail.]]
196 [[`C(s)`] [Copy constructs a cons from a __forward_sequence__, `s`.]]
197 [[`l = s`] [Assigns to a cons, `l`, from a __forward_sequence__, `s`.]]
198 [[`__at__<N>(l)`] [The Nth element from the beginning of the sequence; see __at__.]]
199 ]
200
201 [note `__at__<N>(l)` is provided for convenience and compatibility
202 with the original __tuple__ library, despite `cons` being a
203 __forward_sequence__ only (`at` is supposed to be a
204 __random_access_sequence__ requirement). The runtime complexity of __at__ is
205 constant (see __recursive_inline__).]
206
207 [heading Example]
208
209 cons<int, cons<float> > l(12, cons<float>(5.5f));
210 std::cout << __at_c__<0>(l) << std::endl;
211 std::cout << __at_c__<1>(l) << std::endl;
212
213 [endsect]
214
215 [section list]
216
217 [heading Description]
218
219 `list` is a __forward_sequence__ of heterogeneous typed data built on top of
220 __cons__. It is more efficient than __vector__ when the target sequence is
221 constructed piecemeal (a data at a time). The runtime cost of access to
222 each element is peculiarly constant (see __recursive_inline__).
223
224 [heading Header]
225
226 #include <boost/fusion/container/list.hpp>
227 #include <boost/fusion/include/list.hpp>
228 #include <boost/fusion/container/list/list_fwd.hpp>
229 #include <boost/fusion/include/list_fwd.hpp>
230
231 [heading Synopsis]
232
233 template <
234 typename T0 = __unspecified__
235 , typename T1 = __unspecified__
236 , typename T2 = __unspecified__
237 ...
238 , typename TN = __unspecified__
239 >
240 struct list;
241
242 For C++11 compilers, the variadic function interface has no upper bound.
243
244 For C++03 compilers, the variadic class interface accepts `0` to
245 `FUSION_MAX_LIST_SIZE` elements, where `FUSION_MAX_LIST_SIZE` is a user
246 definable predefined maximum that defaults to `10`. Example:
247
248 list<int, char, double>
249
250 You may define the preprocessor constant `FUSION_MAX_LIST_SIZE` before
251 including any Fusion header to change the default. Example:
252
253 #define FUSION_MAX_LIST_SIZE 20
254
255 [heading Template parameters]
256
257 [table
258 [[Parameter] [Description] [Default]]
259 [[`T0`...`TN`] [Element types] [__unspecified__]]
260 ]
261
262 [heading Model of]
263
264 * __forward_sequence__
265
266 [variablelist Notation
267 [[`L`] [A `list` type]]
268 [[`l`] [An instance of `list`]]
269 [[`e0`...`en`] [Heterogeneous values]]
270 [[`s`] [A __forward_sequence__]]
271 [[`N`] [An __mpl_integral_constant__]]
272 ]
273
274 [heading Expression Semantics]
275
276 Semantics of an expression is defined only where it differs from, or is not
277 defined in __forward_sequence__.
278
279 [table
280 [[Expression] [Semantics]]
281 [[`L()`] [Creates a list with default constructed elements.]]
282 [[`L(e0, e1,... en)`] [Creates a list with elements `e0`...`en`.]]
283 [[`L(s)`] [Copy constructs a list from a __forward_sequence__, `s`.]]
284 [[`l = s`] [Assigns to a list, `l`, from a __forward_sequence__, `s`.]]
285 [[`__at__<N>(l)`] [The Nth element from the beginning of the sequence; see __at__.]]
286 ]
287
288 [note `__at__<n>(l)` is provided for convenience and compatibility
289 with the original __tuple__ library, despite `list` being a
290 __forward_sequence__ only (__at__ is supposed to be a
291 __random_access_sequence__ requirement). The runtime complexity of __at__ is
292 constant (see __recursive_inline__).]
293
294 [heading Example]
295
296 list<int, float> l(12, 5.5f);
297 std::cout << __at_c__<0>(l) << std::endl;
298 std::cout << __at_c__<1>(l) << std::endl;
299
300 [endsect]
301
302 [section deque]
303
304 [heading Description]
305
306 `deque` is a simple __bidirectional_sequence__ that supports
307 constant-time insertion and removal of elements at both ends. Like the
308 __list__ and __cons__, `deque` is more efficient than __vector__
309 (especially at compile time) when the target sequence is constructed
310 piecemeal (a data at a time, e.g. when constructing expression
311 templates). Like the __list__ and __cons__, runtime cost of access to
312 each element is peculiarly constant (see __recursive_inline__).
313
314 Element insertion and removal are done by special `deque` helper classes
315 __front_extended_deque__ and __back_extended_deque__.
316
317 [heading Header]
318
319 #include <boost/fusion/container/deque.hpp>
320 #include <boost/fusion/include/deque.hpp>
321 #include <boost/fusion/container/deque/deque_fwd.hpp>
322 #include <boost/fusion/include/deque_fwd.hpp>
323
324 [heading Synopsis]
325
326 template <typename ...Elements>
327 struct deque;
328
329 For C++11 compilers, the variadic class interface has no upper bound.
330
331 For C++03 compilers, the variadic class interface accepts `0` to
332 `FUSION_MAX_DEQUE_SIZE` elements, where `FUSION_MAX_DEQUE_SIZE` is a
333 user definable predefined maximum that defaults to `10`. Example:
334
335 deque<int, char, double>
336
337 You may define the preprocessor constant `FUSION_MAX_DEQUE_SIZE` before
338 including any Fusion header to change the default. Example:
339
340 #define FUSION_MAX_DEQUE_SIZE 20
341
342 [heading Template parameters]
343
344 [table
345 [[Parameter] [Description] [Default]]
346 [[`Elements`] [Element types] [ ]]
347 ]
348
349 [heading Model of]
350
351 * __bidirectional_sequence__
352
353 [variablelist Notation
354 [[`D`] [A `deque` type]]
355 [[`d`, `d2`] [Instances of `deque`]]
356 [[`e0`...`en`] [Heterogeneous values]]
357 [[`s`] [A __forward_sequence__]]
358 [[`N`] [An __mpl_integral_constant__]]
359 ]
360
361 [heading Expression Semantics]
362
363 Semantics of an expression is defined only where it differs from, or is not
364 defined in __bidirectional_sequence__.
365
366 [table
367 [[Expression] [Semantics]]
368 [[`D()`] [Creates a deque with default constructed elements.]]
369 [[`D(e0, e1,... en)`] [Creates a deque with elements `e0`...`en`.]]
370 [[`D(s)`] [Copy constructs a deque from a __forward_sequence__, `s`.]]
371 [[`d = s`] [Assigns to a deque, `d`, from a __forward_sequence__, `s`.]]
372 [[`__at__<N>(d)`] [The Nth element from the beginning of the sequence; see __at__.]]
373 ]
374
375 [note `__at__<N>(d)` is provided for convenience, despite
376 `deque` being a __bidirectional_sequence__ only (`at` is supposed to be
377 a __random_access_sequence__ requirement). The runtime complexity of
378 __at__ is constant (see __recursive_inline__). `deque` element access
379 utilizes operator overloading with argument dependent lookup (ADL) of
380 the proper element getter function given a static constant index
381 parameter. Interestingly, with modern C++ compilers, this lookup is very
382 fast and rivals recursive template instantiations in compile time-speed,
383 so much so that `deque` relies on ADL for all element access (indexing)
384 as well as iteration.]
385
386 [heading Example]
387
388 deque<int, float> d(12, 5.5f);
389 std::cout << __at_c__<0>(d) << std::endl;
390 std::cout << __at_c__<1>(d) << std::endl;
391
392 [endsect]
393
394 [section front_extended_deque]
395
396 [heading Description]
397
398 `front_extended_deque` allows a __deque__ to be front extended. It shares
399 the same properties as the __deque__.
400
401 [heading Header]
402
403 See __deque__
404
405 [heading Synopsis]
406
407 template <typename Deque, typename T>
408 struct front_extended_deque;
409
410 [heading Template parameters]
411
412 [table
413 [[Parameter] [Description] [Default]]
414 [[`Deque`] [Deque type] [ ]]
415 [[`T`] [Element type] [ ]]
416 ]
417
418 [note `Deque` can be a __deque__, a __front_extended_deque__ or a
419 __back_extended_deque__]
420
421 [heading Model of]
422
423 * __bidirectional_sequence__
424
425 [variablelist Notation
426 [[`D`] [A `front_extended_deque` type]]
427 [[`e`] [Heterogeneous value]]
428 [[`N`] [An __mpl_integral_constant__]]
429 ]
430
431 [heading Expression Semantics]
432
433 Semantics of an expression is defined only where it differs from, or is
434 not defined in __bidirectional_sequence__.
435
436 [table
437 [[Expression] [Semantics]]
438 [[`D(d, e)`] [Extend `d` prepending `e` to its front.]]
439 [[`__at__<N>(d)`] [The Nth element from the beginning of the sequence; see __at__.]]
440 ]
441
442 [note See __deque__ for further details.]
443
444 [heading Example]
445
446 typedef deque<int, float> initial_deque;
447 initial_deque d(12, 5.5f);
448 front_extended_deque<initial_deque, int> d2(d, 999);
449 std::cout << __at_c__<0>(d2) << std::endl;
450 std::cout << __at_c__<1>(d2) << std::endl;
451 std::cout << __at_c__<2>(d2) << std::endl;
452
453 [endsect]
454
455 [section back_extended_deque]
456
457 [heading Description]
458
459 `back_extended_deque` allows a __deque__ to be back extended. It shares
460 the same properties as the __deque__.
461
462 [heading Header]
463
464 See __deque__
465
466 [heading Synopsis]
467
468 template <typename Deque, typename T>
469 struct back_extended_deque;
470
471 [heading Template parameters]
472
473 [table
474 [[Parameter] [Description] [Default]]
475 [[`Deque`] [Deque type] [ ]]
476 [[`T`] [Element type] [ ]]
477 ]
478
479 [note `Deque` can be a __deque__, a __back_extended_deque__ or a
480 __back_extended_deque__]
481
482 [heading Model of]
483
484 * __bidirectional_sequence__
485
486 [variablelist Notation
487 [[`D`] [A `back_extended_deque` type]]
488 [[`e`] [Heterogeneous value]]
489 [[`N`] [An __mpl_integral_constant__]]
490 ]
491
492 [heading Expression Semantics]
493
494 Semantics of an expression is defined only where it differs from, or is
495 not defined in __bidirectional_sequence__.
496
497 [table
498 [[Expression] [Semantics]]
499 [[`D(d, e)`] [Extend `d` prepending `e` to its back.]]
500 [[`__at__<N>(d)`] [The Nth element from the beginning of the sequence; see __at__.]]
501 ]
502
503 [note See __deque__ for further details.]
504
505 [heading Example]
506
507 typedef deque<int, float> initial_deque;
508 initial_deque d(12, 5.5f);
509 back_extended_deque<initial_deque, int> d2(d, 999);
510 std::cout << __at_c__<0>(d2) << std::endl;
511 std::cout << __at_c__<1>(d2) << std::endl;
512 std::cout << __at_c__<2>(d2) << std::endl;
513
514 [endsect]
515
516 [section set]
517
518 [heading Description]
519
520 set is an __associative_sequence__ of heterogeneous typed data elements.
521 Type identity is used to impose an equivalence relation on keys. The
522 element's type is its key. A set may contain at most one element for each
523 key. Membership testing and element key lookup has constant runtime
524 complexity (see __overloaded_functions__).
525
526 [heading Header]
527
528 #include <boost/fusion/container/set.hpp>
529 #include <boost/fusion/include/set.hpp>
530 #include <boost/fusion/container/set/set_fwd.hpp>
531 #include <boost/fusion/include/set_fwd.hpp>
532
533 [heading Synopsis]
534
535 template <
536 typename T0 = __unspecified__
537 , typename T1 = __unspecified__
538 , typename T2 = __unspecified__
539 ...
540 , typename TN = __unspecified__
541 >
542 struct set;
543
544 For C++11 compilers, the variadic function interface has no upper bound.
545
546 For C++03 compilers, the variadic class interface accepts `0` to
547 `FUSION_MAX_SET_SIZE` elements, where `FUSION_MAX_SET_SIZE` is a user
548 definable predefined maximum that defaults to `10`. Example:
549
550 set<int, char, double>
551
552 You may define the preprocessor constant `FUSION_MAX_SET_SIZE` before
553 including any Fusion header to change the default. Example:
554
555 #define FUSION_MAX_SET_SIZE 20
556
557 [heading Template parameters]
558
559 [table
560 [[Parameter] [Description] [Default]]
561 [[`T0`...`TN`] [Element types] [__unspecified__]]
562 ]
563
564 [heading Model of]
565
566 * __associative_sequence__
567 * __forward_sequence__
568
569 [variablelist Notation
570 [[`S`] [A `set` type]]
571 [[`s`] [An instance of `set`]]
572 [[`e0`...`en`] [Heterogeneous values]]
573 [[`fs`] [A __forward_sequence__]]
574 ]
575
576 [heading Expression Semantics]
577
578 Semantics of an expression is defined only where it differs from, or is not
579 defined in __random_access_sequence__ and __associative_sequence__.
580
581 [table
582 [[Expression] [Semantics]]
583 [[`S()`] [Creates a set with default constructed elements.]]
584 [[`S(e0, e1,... en)`] [Creates a set with elements `e0`...`en`.]]
585 [[`S(fs)`] [Copy constructs a set from a __forward_sequence__ `fs`.]]
586 [[`s = fs`] [Assigns to a set, `s`, from a __forward_sequence__ `fs`.]]
587 ]
588
589 [heading Example]
590
591 typedef set<int, float> S;
592 S s(12, 5.5f);
593 std::cout << __at_key__<int>(s) << std::endl;
594 std::cout << __at_key__<float>(s) << std::endl;
595 std::cout << __result_of_has_key__<S, double>::value << std::endl;
596
597 [endsect]
598
599 [section map]
600
601 [heading Description]
602
603 map is an __associative_sequence__ of heterogeneous typed data elements.
604 Each element is a key/data pair (see __fusion_pair__) where the key has no
605 data (type only). Type identity is used to impose an equivalence relation
606 on keys. A map may contain at most one element for each key. Membership
607 testing and element key lookup has constant runtime complexity (see
608 __overloaded_functions__).
609
610 [heading Header]
611
612 #include <boost/fusion/container/map.hpp>
613 #include <boost/fusion/include/map.hpp>
614 #include <boost/fusion/container/map/map_fwd.hpp>
615 #include <boost/fusion/include/map_fwd.hpp>
616
617 [heading Synopsis]
618
619 template <
620 typename T0 = __unspecified__
621 , typename T1 = __unspecified__
622 , typename T2 = __unspecified__
623 ...
624 , typename TN = __unspecified__
625 >
626 struct map;
627
628 For C++11 compilers, the variadic function interface has no upper bound.
629
630 For C++03 compilers, the variadic class interface accepts `0` to
631 `FUSION_MAX_MAP_SIZE` elements, where `FUSION_MAX_MAP_SIZE` is a user
632 definable predefined maximum that defaults to `10`. Example:
633
634 map<__pair__<int, char>, __pair__<char, char>, __pair__<double, char> >
635
636 You may define the preprocessor constant `FUSION_MAX_MAP_SIZE` before
637 including any Fusion header to change the default. Example:
638
639 #define FUSION_MAX_MAP_SIZE 20
640
641 [heading Template parameters]
642
643 [table
644 [[Parameter] [Description] [Default]]
645 [[`T0`...`TN`] [Element types] [__unspecified__]]
646 ]
647
648 [heading Model of]
649
650 * __associative_sequence__
651 * __random_access_sequence__
652
653 [variablelist Notation
654 [[`M`] [A `map` type]]
655 [[`m`] [An instance of `map`]]
656 [[`e0`...`en`] [Heterogeneous key/value pairs (see __fusion_pair__)]]
657 [[`s`] [A __forward_sequence__]]
658 ]
659
660 [heading Expression Semantics]
661
662 Semantics of an expression is defined only where it differs from, or is not
663 defined in __forward_sequence__ and __associative_sequence__.
664
665 [table
666 [[Expression] [Semantics]]
667 [[`M()`] [Creates a map with default constructed elements.]]
668 [[`M(e0, e1,... en)`] [Creates a map with element pairs `e0`...`en`.]]
669 [[`M(s)`] [Copy constructs a map from a __forward_sequence__ `s`.]]
670 [[`m = s`] [Assigns to a map, `m`, from a __forward_sequence__ `s`.]]
671 ]
672
673 [heading Example]
674
675 typedef map<
676 __pair__<int, char>
677 , __pair__<double, std::string> >
678 map_type;
679
680 map_type m(
681 __fusion_make_pair__<int>('X')
682 , __fusion_make_pair__<double>("Men"));
683
684 std::cout << __at_key__<int>(m) << std::endl;
685 std::cout << __at_key__<double>(m) << std::endl;
686
687 [endsect]
688
689 [section Generation]
690
691 These are the functions that you can use to generate various forms of
692 __containers__ from elemental values.
693
694 [heading Header]
695
696 #include <boost/fusion/container/generation.hpp>
697 #include <boost/fusion/include/generation.hpp>
698
699 [section Functions]
700
701 [section make_list]
702
703 [heading Description]
704
705 Create a __list__ from one or more values.
706
707 [heading Synopsis]
708
709 template <typename T0, typename T1,... typename TN>
710 typename __result_of_make_list__<T0, T1,... TN>::type
711 make_list(T0 const& x0, T1 const& x1... TN const& xN);
712
713 For C++11 compilers, the variadic function interface has no upper bound.
714
715 For C++03 compilers, the variadic function accepts `0` to
716 `FUSION_MAX_LIST_SIZE` elements, where `FUSION_MAX_LIST_SIZE` is a user
717 definable predefined maximum that defaults to `10`. You may define the
718 preprocessor constant `FUSION_MAX_LIST_SIZE` before including any Fusion
719 header to change the default. Example:
720
721 #define FUSION_MAX_LIST_SIZE 20
722
723 [heading Parameters]
724
725 [table
726 [[Parameter] [Requirement] [Description]]
727 [[`x0, x1,... xN`] [Instances of `T0, T1,... TN`] [The arguments to `make_list`]]
728 ]
729
730 [heading Expression Semantics]
731
732 make_list(x0, x1,... xN);
733
734 [*Return type]: __result_of_make_list__`<T0, T1,... TN>::type`
735
736 [*Semantics]: Create a __list__ from `x0, x1,... xN`.
737
738 [heading Header]
739
740 #include <boost/fusion/container/generation/make_list.hpp>
741 #include <boost/fusion/include/make_list.hpp>
742
743 [heading Example]
744
745 make_list(123, "hello", 12.5)
746
747 [heading See also]
748
749 __note_ref_wrappers__
750
751 [endsect]
752
753 [section make_cons]
754
755 [heading Description]
756
757 Create a __cons__ from `car` (/head/) and optional `cdr` (/tail/).
758
759 [heading Synopsis]
760
761 template <typename Car>
762 typename __result_of_make_cons__<Car>::type
763 make_cons(Car const& car);
764
765 template <typename Car, typename Cdr>
766 typename __result_of_make_cons__<Car, Cdr>::type
767 make_cons(Car const& car, Cdr const& cdr);
768
769 [heading Parameters]
770
771 [table
772 [[Parameter] [Requirement] [Description]]
773 [[`car`] [Instance of `Car`] [The list's head]]
774 [[`cdr`] [Instance of `Cdr`] [The list's tail (optional)]]
775 ]
776
777 [heading Expression Semantics]
778
779 make_cons(car, cdr);
780
781 [*Return type]: __result_of_make_cons__`<Car, Cdr>::type` or
782 __result_of_make_cons__`<Car>::type`
783
784 [*Semantics]: Create a __cons__ from `car` (/head/) and optional `cdr` (/tail/).
785
786 [heading Header]
787
788 #include <boost/fusion/container/generation/make_cons.hpp>
789 #include <boost/fusion/include/make_cons.hpp>
790
791 [heading Example]
792
793 make_cons('x', make_cons(123))
794
795 [heading See also]
796
797 __note_ref_wrappers__
798
799 [endsect]
800
801 [section make_vector]
802
803 [heading Description]
804
805 Create a __vector__ from one or more values.
806
807 [heading Synopsis]
808
809 template <typename T0, typename T1,... typename TN>
810 typename __result_of_make_vector__<T0, T1,... TN>::type
811 make_vector(T0 const& x0, T1 const& x1... TN const& xN);
812
813 For C++11 compilers, the variadic function interface has no upper bound.
814
815 For C++03 compilers, the variadic function accepts `0` to
816 `FUSION_MAX_VECTOR_SIZE` elements, where `FUSION_MAX_VECTOR_SIZE` is a
817 user definable predefined maximum that defaults to `10`. You may define
818 the preprocessor constant `FUSION_MAX_VECTOR_SIZE` before including any
819 Fusion header to change the default. Example:
820
821 #define FUSION_MAX_VECTOR_SIZE 20
822
823 [heading Parameters]
824
825 [table
826 [[Parameter] [Requirement] [Description]]
827 [[`x0, x1,... xN`] [Instances of `T0, T1,... TN`] [The arguments to `make_vector`]]
828 ]
829
830 [heading Expression Semantics]
831
832 make_vector(x0, x1,... xN);
833
834 [*Return type]: __result_of_make_vector__`<T0, T1,... TN>::type`
835
836 [*Semantics]: Create a __vector__ from `x0, x1,... xN`.
837
838 [heading Header]
839
840 #include <boost/fusion/container/generation/make_vector.hpp>
841 #include <boost/fusion/include/make_vector.hpp>
842
843 [heading Example]
844
845 make_vector(123, "hello", 12.5)
846
847 [heading See also]
848
849 __note_ref_wrappers__
850
851 [endsect]
852
853 [section make_deque]
854
855 [heading Description]
856
857 Create a __deque__ from one or more values.
858
859 [heading Synopsis]
860
861 template <typename ...Elements>
862 typename __result_of_make_deque__<Elements...>::type
863 make_deque(Elements const&... elements);
864
865 For C++11 compilers, the variadic function interface has no upper bound.
866
867 For C++03 compilers, the variadic function accepts `0` to
868 `FUSION_MAX_DEQUE_SIZE` elements, where `FUSION_MAX_DEQUE_SIZE` is a
869 user definable predefined maximum that defaults to `10`. You may define
870 the preprocessor constant `FUSION_MAX_DEQUE_SIZE` before including any
871 Fusion header to change the default. Example:
872
873 #define FUSION_MAX_DEQUE_SIZE 20
874
875 [heading Parameters]
876
877 [table
878 [[Parameter] [Description] [Description]]
879 [[`elements`] [Instances of `Elements`] [The arguments to `make_deque`]]
880 ]
881
882 [heading Expression Semantics]
883
884 make_deque(elements...);
885
886 [*Return type]: __result_of_make_deque__`<Elements...>::type`
887
888 [*Semantics]: Create a __deque__ from `elements...`.
889
890 [heading Header]
891
892 #include <boost/fusion/container/generation/make_deque.hpp>
893 #include <boost/fusion/include/make_deque.hpp>
894
895 [heading Example]
896
897 make_deque(123, "hello", 12.5)
898
899 [heading See also]
900
901 __note_ref_wrappers__
902
903 [endsect]
904
905 [section make_set]
906
907 [heading Description]
908
909 Create a __set__ from one or more values.
910
911 [heading Synopsis]
912
913 template <typename T0, typename T1,... typename TN>
914 typename __result_of_make_set__<T0, T1,... TN>::type
915 make_set(T0 const& x0, T1 const& x1... TN const& xN);
916
917 For C++11 compilers, the variadic function interface has no upper bound.
918
919 For C++03 compilers, the variadic function accepts `0` to
920 `FUSION_MAX_SET_SIZE` elements, where `FUSION_MAX_SET_SIZE` is a user
921 definable predefined maximum that defaults to `10`. You may define the
922 preprocessor constant `FUSION_MAX_SET_SIZE` before including any Fusion
923 header to change the default. Example:
924
925 #define FUSION_MAX_SET_SIZE 20
926
927 [heading Parameters]
928
929 [table
930 [[Parameter] [Requirement] [Description]]
931 [[`x0, x1,... xN`] [Instances of `T0, T1,... TN`] [The arguments to `make_set`]]
932 ]
933
934 [heading Expression Semantics]
935
936 make_set(x0, x1,... xN);
937
938 [*Return type]: __result_of_make_set__`<T0, T1,... TN>::type`
939
940 [*Semantics]: Create a __set__ from `x0, x1,... xN`.
941
942 [*Precondition]: There may be no duplicate key types.
943
944 [heading Header]
945
946 #include <boost/fusion/container/generation/make_set.hpp>
947 #include <boost/fusion/include/make_set.hpp>
948
949 [heading Example]
950
951 make_set(123, "hello", 12.5)
952
953 [heading See also]
954
955 __note_ref_wrappers__
956
957 [endsect]
958
959 [section make_map]
960
961 [heading Description]
962
963 Create a __map__ from one or more key/data pairs.
964
965 [heading Synopsis]
966
967 template <
968 typename K0, typename K1,... typename KN
969 , typename T0, typename T1,... typename TN>
970 typename __result_of_make_map__<K0, K0,... KN, T0, T1,... TN>::type
971 make_map(T0 const& x0, T1 const& x1... TN const& xN);
972
973 For C++11 compilers, the variadic function interface has no upper bound.
974
975 For C++03 compilers, the variadic function accepts `0` to `FUSION_MAX_MAP_SIZE` elements,
976 where `FUSION_MAX_MAP_SIZE` is a user definable predefined maximum that
977 defaults to `10`. You may define the preprocessor constant
978 `FUSION_MAX_MAP_SIZE` before including any Fusion header to change the
979 default. Example:
980
981 #define FUSION_MAX_MAP_SIZE 20
982
983 [heading Parameters]
984
985 [table
986 [[Parameter] [Requirement] [Description]]
987 [[`K0, K1,... KN`] [The key types] [Keys associated with `x0, x1,... xN`]]
988 [[`x0, x1,... xN`] [Instances of `T0, T1,... TN`] [The arguments to `make_map`]]
989 ]
990
991 [heading Expression Semantics]
992
993 make_map<K0, K1,... KN>(x0, x1,... xN);
994
995 [*Return type]: __result_of_make_map__`<K0, K0,... KN, T0, T1,... TN>::type`
996
997 [*Semantics]: Create a __map__ from `K0, K1,... KN` keys and
998 `x0, x1,... xN` data.
999
1000 [*Precondition]: There may be no duplicate key types.
1001
1002 [heading Header]
1003
1004 #include <boost/fusion/container/generation/make_map.hpp>
1005 #include <boost/fusion/include/make_map.hpp>
1006
1007 [heading Example]
1008
1009 make_map<int, double>('X', "Men")
1010
1011 [heading See also]
1012
1013 __note_ref_wrappers__, __fusion_pair__
1014
1015 [endsect]
1016
1017 [section Tiers]
1018
1019 Tiers are sequences, where all elements are non-const reference types. They
1020 are constructed with a call to a couple of /tie/ function templates. The
1021 succeeding sections document the various /tier/ flavors.
1022
1023 * __list_tie__
1024 * __vector_tie__
1025 * __map_tie__
1026 * __deque_tie__
1027
1028 Example:
1029
1030 int i; char c; double d;
1031 ...
1032 __vector_tie__(i, c, d);
1033
1034 The __vector_tie__ function creates a __vector__ of type
1035 `__vector__<int&, char&, double&>`. The same result could be achieved with the call
1036 __make_vector__(__boost_ref_call__(i), __boost_ref_call__(c), __boost_ref_call__(d))
1037 [footnote see __boost_ref__ for details about `ref`].
1038
1039 A /tie/ can be used to 'unpack' another tuple into variables. E.g.:
1040
1041 int i; char c; double d;
1042 __vector_tie__(i, c, d) = __make_vector__(1,'a', 5.5);
1043 std::cout << i << " " << c << " " << d;
1044
1045 This code prints 1 a 5.5 to the standard output stream. A sequence
1046 unpacking operation like this is found for example in ML and Python. It is
1047 convenient when calling functions which return sequences.
1048
1049 [heading Ignore]
1050
1051 There is also an object called /ignore/ which allows you to ignore an
1052 element assigned by a sequence. The idea is that a function may return a
1053 sequence, only part of which you are interested in. For example:
1054
1055 char c;
1056 __vector_tie__(ignore, c) = __make_vector__(1, 'a');
1057
1058 [endsect]
1059
1060 [section list_tie]
1061
1062 [heading Description]
1063
1064 Constructs a tie using a __list__ sequence.
1065
1066 [heading Synopsis]
1067
1068 template <typename T0, typename T1,... typename TN>
1069 __list__<T0&, T1&,... TN&>
1070 list_tie(T0& x0, T1& x1... TN& xN);
1071
1072 For C++11 compilers, the variadic function interface has no upper bound.
1073
1074 For C++03 compilers, the variadic function accepts `0` to
1075 `FUSION_MAX_LIST_SIZE` elements, where `FUSION_MAX_LIST_SIZE` is a user
1076 definable predefined maximum that defaults to `10`. You may define the
1077 preprocessor constant `FUSION_MAX_LIST_SIZE` before including any Fusion
1078 header to change the default. Example:
1079
1080 #define FUSION_MAX_LIST_SIZE 20
1081
1082 [heading Parameters]
1083
1084 [table
1085 [[Parameter] [Requirement] [Description]]
1086 [[`x0, x1,... xN`] [Instances of `T0, T1,... TN`] [The arguments to `list_tie`]]
1087 ]
1088
1089 [heading Expression Semantics]
1090
1091 list_tie(x0, x1,... xN);
1092
1093 [*Return type]: __list__<T0&, T1&,... TN&>
1094
1095 [*Semantics]: Create a __list__ of references from `x0, x1,... xN`.
1096
1097 [heading Header]
1098
1099 #include <boost/fusion/container/generation/list_tie.hpp>
1100 #include <boost/fusion/include/list_tie.hpp>
1101
1102 [heading Example]
1103
1104 int i = 123;
1105 double d = 123.456;
1106 list_tie(i, d)
1107
1108 [endsect]
1109
1110 [section vector_tie]
1111
1112 [heading Description]
1113
1114 Constructs a tie using a __vector__ sequence.
1115
1116 [heading Synopsis]
1117
1118 template <typename T0, typename T1,... typename TN>
1119 __vector__<T0&, T1&,... TN&>
1120 vector_tie(T0& x0, T1& x1... TN& xN);
1121
1122 For C++11 compilers, the variadic function interface has no upper bound.
1123
1124 For C++03 compilers, the variadic function accepts `0` to
1125 `FUSION_MAX_VECTOR_SIZE` elements, where `FUSION_MAX_VECTOR_SIZE` is a
1126 user definable predefined maximum that defaults to `10`. You may define
1127 the preprocessor constant `FUSION_MAX_VECTOR_SIZE` before including any
1128 Fusion header to change the default. Example:
1129
1130 #define FUSION_MAX_VECTOR_SIZE 20
1131
1132 [heading Parameters]
1133
1134 [table
1135 [[Parameter] [Requirement] [Description]]
1136 [[`x0, x1,... xN`] [Instances of `T0, T1,... TN`] [The arguments to `vector_tie`]]
1137 ]
1138
1139 [heading Expression Semantics]
1140
1141 vector_tie(x0, x1,... xN);
1142
1143 [*Return type]: __vector__<T0&, T1&,... TN&>
1144
1145 [*Semantics]: Create a __vector__ of references from `x0, x1,... xN`.
1146
1147 [heading Header]
1148
1149 #include <boost/fusion/container/generation/vector_tie.hpp>
1150 #include <boost/fusion/include/vector_tie.hpp>
1151
1152 [heading Example]
1153
1154 int i = 123;
1155 double d = 123.456;
1156 vector_tie(i, d)
1157
1158 [endsect]
1159
1160 [section map_tie]
1161
1162 [heading Description]
1163
1164 Constructs a tie using a __map__ sequence.
1165
1166 [heading Synopsis]
1167
1168 template <typename K0, typename K1,... typename KN, typename D0, typename D1,... typename DN>
1169 __map__<__pair__<K0, D0&>, __pair__<K1, D1&>,... __pair__<KN, DN&> >
1170 map_tie(D0& d0, D1& d1... DN& dN);
1171
1172 For C++11 compilers, the variadic function interface has no upper bound.
1173
1174 For C++03 compilers, the variadic function accepts `0` to
1175 `FUSION_MAX_MAP_SIZE` elements, where `FUSION_MAX_MAP_SIZE` is a user
1176 definable predefined maximum that defaults to `10`, and a corresponding
1177 number of key types. You may define the preprocessor constant
1178 `FUSION_MAX_MAP_SIZE` before including any Fusion header to change the
1179 default. Example:
1180
1181 #define FUSION_MAX_MAP_SIZE 20
1182
1183 [heading Parameters]
1184
1185 [table
1186 [[Parameter] [Requirement] [Description]]
1187 [[`K0, K1,... KN`] [Any type][The key types associated with each of the `x1,x2,...,xN` values]]
1188 [[`x0, x1,... xN`] [Instances of `T0, T1,... TN`] [The arguments to `map_tie`]]
1189 ]
1190
1191 [heading Expression Semantics]
1192
1193 map_tie<K0, K1,... KN>(x0, x1,... xN);
1194
1195 [*Return type]: __map__<__pair__<K0, D0&>, __pair__<K1, D1&>,... __pair__<KN, DN&> >
1196
1197 [*Semantics]: Create a __map__ of references from `x0, x1,... xN` with keys `K0, K1,... KN`
1198
1199 [heading Header]
1200
1201 #include <boost/fusion/container/generation/map_tie.hpp>
1202 #include <boost/fusion/include/map_tie.hpp>
1203
1204 [heading Example]
1205
1206 struct int_key;
1207 struct double_key;
1208 ...
1209 int i = 123;
1210 double d = 123.456;
1211 map_tie<int_key, double_key>(i, d)
1212
1213 [endsect]
1214
1215 [section deque_tie]
1216
1217 [heading Description]
1218
1219 Constructs a tie using a __deque__ sequence.
1220
1221 [heading Synopsis]
1222
1223 template <typename ...Elements>
1224 __deque__<Elements&...>
1225 deque_tie(Elements&... elements);
1226
1227 For C++11 compilers, the variadic function interface has no upper bound.
1228
1229 For C++03 compilers, the variadic function accepts `0` to
1230 `FUSION_MAX_DEQUE_SIZE` elements, where `FUSION_MAX_DEQUE_SIZE` is a
1231 user definable predefined maximum that defaults to `10`. You may define
1232 the preprocessor constant `FUSION_MAX_DEQUE_SIZE` before including any
1233 Fusion header to change the default. Example:
1234
1235 #define FUSION_MAX_DEQUE_SIZE 20
1236
1237 [heading Parameters]
1238
1239 [table
1240 [[Parameter] [Description] [Description]]
1241 [[`elements`] [Instances of `Elements`] [The arguments to `deque_tie`]]
1242 ]
1243
1244 [heading Expression Semantics]
1245
1246 deque_tie(elements...);
1247
1248 [*Return type]: __deque__<Elements&...>
1249
1250 [*Semantics]: Create a __deque__ of references from `elements...`.
1251
1252 [heading Header]
1253
1254 #include <boost/fusion/container/generation/deque_tie.hpp>
1255 #include <boost/fusion/include/deque_tie.hpp>
1256
1257 [heading Example]
1258
1259 int i = 123;
1260 double d = 123.456;
1261 deque_tie(i, d)
1262
1263 [endsect]
1264
1265 [endsect]
1266
1267 [section MetaFunctions]
1268
1269 [section make_list]
1270
1271 [heading Description]
1272
1273 Returns the result type of __make_list__.
1274
1275 [heading Synopsis]
1276
1277 template <typename T0, typename T1,... typename TN>
1278 struct make_list;
1279
1280 For C++11 compilers, the variadic function interface has no upper bound.
1281
1282 For C++03 compilers, the variadic function accepts `0` to
1283 `FUSION_MAX_LIST_SIZE` elements, where `FUSION_MAX_LIST_SIZE` is a user
1284 definable predefined maximum that defaults to `10`. You may define the
1285 preprocessor constant `FUSION_MAX_LIST_SIZE` before including any Fusion
1286 header to change the default. Example:
1287
1288 #define FUSION_MAX_LIST_SIZE 20
1289
1290 [heading Parameters]
1291
1292 [table
1293 [[Parameter] [Requirement] [Description]]
1294 [[`T0, T1,... TN`] [Any type] [Template arguments to `make_list`]]
1295 ]
1296
1297 [heading Expression Semantics]
1298
1299 result_of::make_list<T0, T1,... TN>::type
1300
1301 [*Return type]: A __list__ with elements of types converted following the
1302 rules for __element_conversion__.
1303
1304 [*Semantics]: Create a __list__ from `T0, T1,... TN`.
1305
1306 [heading Header]
1307
1308 #include <boost/fusion/container/generation/make_list.hpp>
1309 #include <boost/fusion/include/make_list.hpp>
1310
1311 [heading Example]
1312
1313 result_of::make_list<int, const char(&)[7], double>::type
1314
1315 [endsect]
1316
1317 [section make_cons]
1318
1319 [heading Description]
1320
1321 Returns the result type of __make_cons__.
1322
1323 [heading Synopsis]
1324
1325 template <typename Car, typename Cdr = nil>
1326 struct make_cons;
1327
1328 [heading Parameters]
1329
1330 [table
1331 [[Parameter] [Requirement] [Description]]
1332 [[`Car`] [Any type] [The list's head type]]
1333 [[`Cdr`] [A `cons`] [The list's tail type (optional)]]
1334 ]
1335
1336 [heading Expression Semantics]
1337
1338 result_of::make_cons<Car, Cdr>::type
1339
1340 [*Return type]: A __cons__ with head element, `Car`, of type converted
1341 following the rules for __element_conversion__, and tail, `Cdr`.
1342
1343 [*Semantics]: Create a __cons__ from `Car` (/head/) and optional `Cdr` (/tail/).
1344
1345 [heading Header]
1346
1347 #include <boost/fusion/container/generation/make_cons.hpp>
1348 #include <boost/fusion/include/make_cons.hpp>
1349
1350 [heading Example]
1351
1352 result_of::make_cons<char, result_of::make_cons<int>::type>::type
1353
1354 [endsect]
1355
1356 [section make_vector]
1357
1358 [heading Description]
1359
1360 Returns the result type of __make_vector__.
1361
1362 [heading Synopsis]
1363
1364 template <typename T0, typename T1,... typename TN>
1365 struct make_vector;
1366
1367 For C++11 compilers, the variadic function interface has no upper bound.
1368
1369 For C++03 compilers, the variadic function accepts `0` to
1370 `FUSION_MAX_VECTOR_SIZE` elements, where `FUSION_MAX_VECTOR_SIZE` is a user
1371 definable predefined maximum that defaults to `10`. You may define the
1372 preprocessor constant `FUSION_MAX_VECTOR_SIZE` before including any Fusion
1373 header to change the default. Example:
1374
1375 #define FUSION_MAX_VECTOR_SIZE 20
1376
1377 [heading Parameters]
1378
1379 [table
1380 [[Parameter] [Requirement] [Description]]
1381 [[`T0, T1,... TN`] [Any type] [Template arguments to `make_vector`]]
1382 ]
1383
1384 [heading Expression Semantics]
1385
1386 result_of::make_vector<T0, T1,... TN>::type
1387
1388 [*Return type]: A __vector__ with elements of types converted following the
1389 rules for __element_conversion__.
1390
1391 [*Semantics]: Create a __vector__ from `T0, T1,... TN`.
1392
1393 [heading Header]
1394
1395 #include <boost/fusion/container/generation/make_vector.hpp>
1396 #include <boost/fusion/include/make_vector.hpp>
1397
1398 [heading Example]
1399
1400 result_of::make_vector<int, const char(&)[7], double>::type
1401
1402 [endsect]
1403
1404 [section make_deque]
1405
1406 [heading Description]
1407
1408 Returns the result type of __make_deque__.
1409
1410 [heading Synopsis]
1411
1412 template <typename ...Elements>
1413 struct make_deque;
1414
1415 For C++11 compilers, the variadic template interface has no upper bound.
1416
1417 For C++03 The variadic function accepts `0` to `FUSION_MAX_DEQUE_SIZE`
1418 elements, where `FUSION_MAX_DEQUE_SIZE` is a user definable predefined
1419 maximum that defaults to `10`. You may define the preprocessor constant
1420 `FUSION_MAX_DEQUE_SIZE` before including any Fusion header to change the
1421 default. Example:
1422
1423 #define FUSION_MAX_DEQUE_SIZE 20
1424
1425 [heading Parameters]
1426
1427 [table
1428 [[Parameter] [Requirement] [Description]]
1429 [[`Elements`] [Variadic template types] [Template arguments to `make_deque`]]
1430 ]
1431
1432 [heading Expression Semantics]
1433
1434 result_of::make_deque<Elements...>::type
1435
1436 [*Return type]: A __deque__ with elements of types converted following the
1437 rules for __element_conversion__.
1438
1439 [*Semantics]: Create a __deque__ from `Elements...`.
1440
1441 [heading Header]
1442
1443 #include <boost/fusion/container/generation/make_deque.hpp>
1444 #include <boost/fusion/include/make_deque.hpp>
1445
1446 [heading Example]
1447
1448 result_of::make_deque<int, const char(&)[7], double>::type
1449
1450 [endsect]
1451
1452 [section make_set]
1453
1454 [heading Description]
1455
1456 Returns the result type of __make_set__.
1457
1458 [heading Synopsis]
1459
1460 template <typename T0, typename T1,... typename TN>
1461 struct make_set;
1462
1463 For C++11 compilers, the variadic function interface has no upper bound.
1464
1465 For C++03 compilers, the variadic function accepts `0` to
1466 `FUSION_MAX_SET_SIZE` elements, where `FUSION_MAX_SET_SIZE` is a user definable
1467 predefined maximum that defaults to `10`. You may define the preprocessor
1468 constant `FUSION_MAX_SET_SIZE` before including any Fusion header to change
1469 the default. Example:
1470
1471 #define FUSION_MAX_SET_SIZE 20
1472
1473 [heading Parameters]
1474
1475 [table
1476 [[Parameter] [Requirement] [Description]]
1477 [[`T0, T1,... TN`] [Any type] [The arguments to `make_set`]]
1478 ]
1479
1480 [heading Expression Semantics]
1481
1482 result_of::make_set<T0, T1,... TN>::type
1483
1484 [*Return type]: A __set__ with elements of types converted following the
1485 rules for __element_conversion__.
1486
1487 [*Semantics]: Create a __set__ from `T0, T1,... TN`.
1488
1489 [*Precondition]: There may be no duplicate key types.
1490
1491 [heading Header]
1492
1493 #include <boost/fusion/container/generation/make_set.hpp>
1494 #include <boost/fusion/include/make_set.hpp>
1495
1496 [heading Example]
1497
1498 result_of::make_set<int, char, double>::type
1499
1500 [endsect]
1501
1502 [section make_map]
1503
1504 [heading Description]
1505
1506 Returns the result type of __make_map__.
1507
1508 The implementation depends on the support of variadic templates.
1509
1510 When variadic templates are not supported, make_map is a metafunction of the form:
1511
1512 [heading Synopsis]
1513
1514 template <
1515 typename K0, typename K1,... typename KN
1516 , typename T0, typename T1,... typename TN>
1517 struct make_map;
1518
1519 For C++11 compilers, the variadic function interface has no upper bound.
1520
1521 For C++03 compilers, the variadic function accepts `0` to `FUSION_MAX_MAP_SIZE` elements,
1522 where `FUSION_MAX_MAP_SIZE` is a user definable predefined maximum that
1523 defaults to `10`. You may define the preprocessor constant
1524 `FUSION_MAX_MAP_SIZE` before including any Fusion header to change the
1525 default. Example:
1526
1527 #define FUSION_MAX_MAP_SIZE 20
1528
1529 When variadic templates are supported, make_map is a metafunction class of the form:
1530
1531 [heading Synopsis]
1532
1533 template <
1534 typename K0, typename K1,... typename KN>
1535 struct make_map
1536 {
1537 struct apply<
1538 typename T0, typename T1,... typename TN>
1539 };
1540
1541 [heading Parameters]
1542
1543 [table
1544 [[Parameter] [Requirement] [Description]]
1545 [[`K0, K1,... KN`] [Any type] [Keys associated with `T0, T1,... TN`]]
1546 [[`T0, T1,... TN`] [Any type] [Data associated with keys `K0, K1,... KN`]]
1547 ]
1548
1549 [heading Expression Semantics]
1550
1551 #if !defined(BOOST_FUSION_HAS_VARIADIC_MAP)
1552 resulf_of::make_map<K0, K1,... KN, T0, T1,... TN>::type;
1553 #else
1554 resulf_of::make_map<K0, K1,... KN>::apply<T0, T1,... TN>::type;
1555 #endif
1556
1557 [*Return type]: __result_of_make_map__`<K0, K0,... KN, T0, T1,... TN>::type`
1558 when variadic templates are not supported, or
1559 __result_of_make_map__`<K0, K0,... KN>::apply<T0, T1,... TN>::type`
1560 when variadic templates are supported.
1561
1562 [*Semantics]: A __map__ with __fusion_pair__ elements where the
1563 `second_type` is converted following the rules for __element_conversion__.
1564
1565 [*Precondition]: There may be no duplicate key types.
1566
1567 [heading Header]
1568
1569 #include <boost/fusion/container/generation/make_map.hpp>
1570 #include <boost/fusion/include/make_map.hpp>
1571
1572 [heading Example]
1573
1574 #if !defined(BOOST_FUSION_HAS_VARIADIC_MAP)
1575 result_of::make_map<int, double, char, double>::type
1576 #else
1577 result_of::make_map<int, double>::apply<char, double>::type
1578 #endif
1579
1580 [heading See also]
1581
1582 __fusion_pair__
1583
1584 [endsect]
1585
1586 [section list_tie]
1587
1588 [heading Description]
1589
1590 Returns the result type of __list_tie__.
1591
1592 [heading Synopsis]
1593
1594 template <typename T0, typename T1,... typename TN>
1595 struct list_tie;
1596
1597 For C++11 compilers, the variadic function interface has no upper bound.
1598
1599 For C++03 compilers, the variadic function accepts `0` to
1600 `FUSION_MAX_LIST_SIZE` elements, where `FUSION_MAX_LIST_SIZE` is a user
1601 definable predefined maximum that defaults to `10`. You may define the
1602 preprocessor constant `FUSION_MAX_LIST_SIZE` before including any Fusion
1603 header to change the default. Example:
1604
1605 #define FUSION_MAX_LIST_SIZE 20
1606
1607 [heading Parameters]
1608
1609 [table
1610 [[Parameter] [Requirement] [Description]]
1611 [[`T0, T1,... TN`] [Any type] [The arguments to `list_tie`]]
1612 ]
1613
1614 [heading Expression Semantics]
1615
1616 result_of::list_tie<T0, T1,... TN>::type;
1617
1618 [*Return type]: __list__<T0&, T1&,... TN&>
1619
1620 [*Semantics]: Create a __list__ of references from `T0, T1,... TN`.
1621
1622 [heading Header]
1623
1624 #include <boost/fusion/container/generation/list_tie.hpp>
1625 #include <boost/fusion/include/list_tie.hpp>
1626
1627 [heading Example]
1628
1629 result_of::list_tie<int, double>::type
1630
1631 [endsect]
1632
1633 [section vector_tie]
1634
1635 [heading Description]
1636
1637 Returns the result type of __vector_tie__.
1638
1639 [heading Synopsis]
1640
1641 template <typename T0, typename T1,... typename TN>
1642 struct vector_tie;
1643
1644 For C++11 compilers, the variadic function interface has no upper bound.
1645
1646 For C++03 compilers, the variadic function accepts `0` to
1647 `FUSION_MAX_VECTOR_SIZE` elements, where `FUSION_MAX_VECTOR_SIZE` is a user
1648 definable predefined maximum that defaults to `10`. You may define the
1649 preprocessor constant `FUSION_MAX_VECTOR_SIZE` before including any Fusion
1650 header to change the default. Example:
1651
1652 #define FUSION_MAX_VECTOR_SIZE 20
1653
1654 [heading Parameters]
1655
1656 [table
1657 [[Parameter] [Requirement] [Description]]
1658 [[`T0, T1,... TN`] [Any type] [The arguments to `vector_tie`]]
1659 ]
1660
1661 [heading Expression Semantics]
1662
1663 result_of::vector_tie<T0, T1,... TN>::type;
1664
1665 [*Return type]: __vector__<T0&, T1&,... TN&>
1666
1667 [*Semantics]: Create a __vector__ of references from `T0, T1,... TN`.
1668
1669 [heading Header]
1670
1671 #include <boost/fusion/container/generation/vector_tie.hpp>
1672 #include <boost/fusion/include/vector_tie.hpp>
1673
1674 [heading Example]
1675
1676 result_of::vector_tie<int, double>::type
1677
1678 [endsect]
1679
1680 [section deque_tie]
1681
1682 [heading Description]
1683
1684 Returns the result type of __deque_tie__.
1685
1686 [heading Synopsis]
1687
1688 template <typename ...Elements>
1689 struct deque_tie;
1690
1691 For C++11 compilers, the variadic template interface has no upper bound.
1692
1693 For C++03 compilers, the variadic function accepts `0` to
1694 `FUSION_MAX_DEQUE_SIZE` elements, where `FUSION_MAX_DEQUE_SIZE` is a
1695 user definable predefined maximum that defaults to `10`. You may define
1696 the preprocessor constant `FUSION_MAX_DEQUE_SIZE` before including any
1697 Fusion header to change the default. Example:
1698
1699 #define FUSION_MAX_DEQUE_SIZE 20
1700
1701 [heading Parameters]
1702
1703 [table
1704 [[Parameter] [Requirement] [Description]]
1705 [[`Elements`] [Variadic template types] [Template arguments to `deque_tie`]]
1706 ]
1707
1708 [heading Expression Semantics]
1709
1710 result_of::deque_tie<Elements...>::type;
1711
1712 [*Return type]: __deque__<Elements&...>
1713
1714 [*Semantics]: Create a __deque__ of references from `Elements...`.
1715
1716 [heading Header]
1717
1718 #include <boost/fusion/container/generation/deque_tie.hpp>
1719 #include <boost/fusion/include/deque_tie.hpp>
1720
1721 [heading Example]
1722
1723 result_of::deque_tie<int, double>::type
1724
1725 [endsect]
1726
1727 [section map_tie]
1728
1729 [heading Description]
1730
1731 Returns the result type of __map_tie__.
1732
1733 [heading Synopsis]
1734
1735 template <typename K0, typename K1,... typename KN, typename D0, typename D1,... typename DN>
1736 struct map_tie;
1737
1738 For C++11 compilers, the variadic function interface has no upper bound.
1739
1740 For C++03 compilers, the variadic function accepts `0` to
1741 `FUSION_MAX_MAP_SIZE` elements, where `FUSION_MAX_MAP_SIZE` is a user definable
1742 predefined maximum that defaults to `10`. You may define the preprocessor
1743 constant `FUSION_MAX_MAP_SIZE` before including any Fusion header to change
1744 the default. Example:
1745
1746 #define FUSION_MAX_MAP_SIZE 20
1747
1748 [heading Parameters]
1749
1750 [table
1751 [[Parameter] [Requirement] [Description]]
1752 [[`K0, K1,... KN`] [Any type] [The key types for `map_tie`]]
1753 [[`D0, D1,... DN`] [Any type] [The arguments types for `map_tie`]]
1754 ]
1755
1756 [heading Expression Semantics]
1757
1758 result_of::map_tie<K0, K1,... KN, D0, D1,... DN>::type;
1759
1760 [*Return type]: __map__<__pair__<K0, D0&>, __pair__<K1, D1&>,... __pair__<KN, DN&> >
1761
1762 [*Semantics]: Create a __map__ of references from `D0, D1,... DN` with keys `K0, K1,... KN`
1763
1764 [heading Header]
1765
1766 #include <boost/fusion/container/generation/map_tie.hpp>
1767 #include <boost/fusion/include/map_tie.hpp>
1768
1769 [heading Example]
1770
1771 struct int_key;
1772 struct double_key;
1773 ...
1774 result_of::map_tie<int_key, double_key, int, double>::type
1775
1776 [endsect]
1777
1778 [endsect]
1779
1780 [endsect]
1781
1782 [section Conversion]
1783
1784 All fusion sequences can be converted to one of the __containers__ types
1785 using one of these conversion functions.
1786
1787 [heading Header]
1788
1789 #include <boost/fusion/include/convert.hpp>
1790
1791 [section Functions]
1792
1793 [section as_list]
1794
1795 [heading Description]
1796
1797 Convert a fusion sequence to a __list__.
1798
1799 [heading Synopsis]
1800
1801 template <typename Sequence>
1802 typename result_of::as_list<Sequence>::type
1803 as_list(Sequence& seq);
1804
1805 template <typename Sequence>
1806 typename result_of::as_list<Sequence const>::type
1807 as_list(Sequence const& seq);
1808
1809 [heading Parameters]
1810
1811 [table
1812 [[Parameter] [Requirement] [Description]]
1813 [[`seq`] [An instance of Sequence] [The sequence to convert.]]
1814 ]
1815
1816 [heading Expression Semantics]
1817
1818 as_list(seq);
1819
1820 [*Return type]: __result_of_as_list__`<Sequence>::type`
1821
1822 [*Semantics]: Convert a fusion sequence, `seq`, to a __list__.
1823
1824 [heading Header]
1825
1826 #include <boost/fusion/container/list/convert.hpp>
1827 #include <boost/fusion/include/as_list.hpp>
1828
1829 [heading Example]
1830
1831 as_list(__make_vector__('x', 123, "hello"))
1832
1833 [endsect]
1834
1835 [section as_vector]
1836
1837 [heading Description]
1838
1839 Convert a fusion sequence to a __vector__.
1840
1841 [heading Synopsis]
1842
1843 template <typename Sequence>
1844 typename result_of::as_vector<Sequence>::type
1845 as_vector(Sequence& seq);
1846
1847 template <typename Sequence>
1848 typename result_of::as_vector<Sequence const>::type
1849 as_vector(Sequence const& seq);
1850
1851 [heading Parameters]
1852
1853 [table
1854 [[Parameter] [Requirement] [Description]]
1855 [[`seq`] [An instance of Sequence] [The sequence to convert.]]
1856 ]
1857
1858 [heading Expression Semantics]
1859
1860 as_vector(seq);
1861
1862 [*Return type]: __result_of_as_vector__`<Sequence>::type`
1863
1864 [*Semantics]: Convert a fusion sequence, `seq`, to a __vector__.
1865
1866 [heading Header]
1867
1868 #include <boost/fusion/container/vector/convert.hpp>
1869 #include <boost/fusion/include/as_vector.hpp>
1870
1871 [heading Example]
1872
1873 as_vector(__make_list__('x', 123, "hello"))
1874
1875 [endsect]
1876
1877 [section as_deque]
1878
1879 [heading Description]
1880
1881 Convert a fusion sequence to a __deque__.
1882
1883 [heading Synopsis]
1884
1885 template <typename Sequence>
1886 typename result_of::as_deque<Sequence>::type
1887 as_deque(Sequence& seq);
1888
1889 template <typename Sequence>
1890 typename result_of::as_deque<Sequence const>::type
1891 as_deque(Sequence const& seq);
1892
1893 [heading Parameters]
1894
1895 [table
1896 [[Parameter] [Requirement] [Description]]
1897 [[`seq`] [An instance of Sequence] [The sequence to convert.]]
1898 ]
1899
1900 [heading Expression Semantics]
1901
1902 as_deque(seq);
1903
1904 [*Return type]: __result_of_as_deque__`<Sequence>::type`
1905
1906 [*Semantics]: Convert a fusion sequence, `seq`, to a __deque__.
1907
1908 [heading Header]
1909
1910 #include <boost/fusion/container/deque/convert.hpp>
1911 #include <boost/fusion/include/as_deque.hpp>
1912
1913 [heading Example]
1914
1915 as_deque(__make_vector__('x', 123, "hello"))
1916
1917 [endsect]
1918
1919 [section as_set]
1920
1921 [heading Description]
1922
1923 Convert a fusion sequence to a __set__.
1924
1925 [heading Synopsis]
1926
1927 template <typename Sequence>
1928 typename result_of::as_set<Sequence>::type
1929 as_set(Sequence& seq);
1930
1931 template <typename Sequence>
1932 typename result_of::as_set<Sequence const>::type
1933 as_set(Sequence const& seq);
1934
1935 [heading Parameters]
1936
1937 [table
1938 [[Parameter] [Requirement] [Description]]
1939 [[`seq`] [An instance of Sequence] [The sequence to convert.]]
1940 ]
1941
1942 [heading Expression Semantics]
1943
1944 as_set(seq);
1945
1946 [*Return type]: __result_of_as_set__`<Sequence>::type`
1947
1948 [*Semantics]: Convert a fusion sequence, `seq`, to a __set__.
1949
1950 [*Precondition]: There may be no duplicate key types.
1951
1952 [heading Header]
1953
1954 #include <boost/fusion/container/set/convert.hpp>
1955 #include <boost/fusion/include/as_set.hpp>
1956
1957 [heading Example]
1958
1959 as_set(__make_vector__('x', 123, "hello"))
1960
1961 [endsect]
1962
1963 [section as_map]
1964
1965 [heading Description]
1966
1967 Convert a fusion sequence to a __map__.
1968
1969 [heading Synopsis]
1970
1971 template <typename Sequence>
1972 typename result_of::as_map<Sequence>::type
1973 as_map(Sequence& seq);
1974
1975 template <typename Sequence>
1976 typename result_of::as_map<Sequence const>::type
1977 as_map(Sequence const& seq);
1978
1979 [heading Parameters]
1980
1981 [table
1982 [[Parameter] [Requirement] [Description]]
1983 [[`seq`] [An instance of Sequence] [The sequence to convert.]]
1984 ]
1985
1986 [heading Expression Semantics]
1987
1988 as_map(seq);
1989
1990 [*Return type]: __result_of_as_map__`<Sequence>::type`
1991
1992 [*Semantics]: Convert a fusion sequence, `seq`, to a __map__.
1993
1994 [*Precondition]: For non-associative sequence, the elements are assumed to be
1995 __fusion_pair__s. There may be no duplicate __fusion_pair__ key types.
1996
1997 [heading Header]
1998
1999 #include <boost/fusion/container/map/convert.hpp>
2000 #include <boost/fusion/include/as_map.hpp>
2001
2002 [heading Example]
2003
2004 // from sequence of __fusion_pair__
2005 as_map(__make_vector__(
2006 __fusion_make_pair__<int>('X')
2007 , __fusion_make_pair__<double>("Men")))
2008
2009 // from associative sequence
2010 namespace ns
2011 {
2012 struct x_member;
2013 struct y_member;
2014 }
2015 BOOST_FUSION_DEFINE_ASSOC_STRUCT(
2016 (ns),
2017 point,
2018 (int, x, ns::x_member)
2019 (int, y, ns::y_member)
2020 )
2021 ...
2022 as_map(ns::point(123, 456))
2023
2024 [endsect]
2025
2026 [endsect]
2027
2028 [section Metafunctions]
2029
2030 [section as_list]
2031
2032 [heading Description]
2033
2034 Returns the result type of __as_list__.
2035
2036 [heading Synopsis]
2037
2038 template <typename Sequence>
2039 struct as_list;
2040
2041 [heading Parameters]
2042
2043 [table
2044 [[Parameter] [Requirement] [Description]]
2045 [[`Sequence`] [A fusion __sequence__] [The sequence type to convert.]]
2046 ]
2047
2048 [heading Expression Semantics]
2049
2050 result_of::as_list<Sequence>::type;
2051
2052 [*Return type]: A __list__ with same elements as the input sequence,
2053 `Sequence`.
2054
2055 [*Semantics]: Convert a fusion sequence, `Sequence`, to a __list__.
2056
2057 [heading Header]
2058
2059 #include <boost/fusion/container/list/convert.hpp>
2060 #include <boost/fusion/include/as_list.hpp>
2061
2062 [heading Example]
2063
2064 result_of::as_list<__vector__<char, int> >::type
2065
2066 [endsect]
2067
2068 [section as_vector]
2069
2070 [heading Description]
2071
2072 Returns the result type of __as_vector__.
2073
2074 [heading Synopsis]
2075
2076 template <typename Sequence>
2077 struct as_vector;
2078
2079 [heading Parameters]
2080
2081 [table
2082 [[Parameter] [Requirement] [Description]]
2083 [[`Sequence`] [A fusion __sequence__] [The sequence to convert.]]
2084 ]
2085
2086 [heading Expression Semantics]
2087
2088 result_of::as_vector<Sequence>::type;
2089
2090 [*Return type]: A __vector__ with same elements as the input sequence,
2091 `Sequence`.
2092
2093 [*Semantics]: Convert a fusion sequence, `Sequence`, to a __vector__.
2094
2095 [heading Header]
2096
2097 #include <boost/fusion/container/vector/convert.hpp>
2098 #include <boost/fusion/include/as_vector.hpp>
2099
2100 [heading Example]
2101
2102 result_of::as_vector<__list__<char, int> >::type
2103
2104 [endsect]
2105
2106 [section as_deque]
2107
2108 [heading Description]
2109
2110 Returns the result type of __as_deque__.
2111
2112 [heading Synopsis]
2113
2114 template <typename Sequence>
2115 struct as_deque;
2116
2117 [heading Parameters]
2118
2119 [table
2120 [[Parameter] [Requirement] [Description]]
2121 [[`Sequence`] [A fusion __sequence__] [The sequence type to convert.]]
2122 ]
2123
2124 [heading Expression Semantics]
2125
2126 result_of::as_deque<Sequence>::type;
2127
2128 [*Return type]: A __deque__ with same elements as the input sequence,
2129 `Sequence`.
2130
2131 [*Semantics]: Convert a fusion sequence, `Sequence`, to a __deque__.
2132
2133 [heading Header]
2134
2135 #include <boost/fusion/container/deque/convert.hpp>
2136 #include <boost/fusion/include/as_deque.hpp>
2137
2138 [heading Example]
2139
2140 result_of::as_deque<__vector__<char, int> >::type
2141
2142 [endsect]
2143
2144 [section as_set]
2145
2146 [heading Description]
2147
2148 Returns the result type of __as_set__.
2149
2150 [heading Synopsis]
2151
2152 template <typename Sequence>
2153 struct as_set;
2154
2155 [heading Parameters]
2156
2157 [table
2158 [[Parameter] [Requirement] [Description]]
2159 [[`Sequence`] [A fusion __sequence__] [The sequence to convert.]]
2160 ]
2161
2162 [heading Expression Semantics]
2163
2164 result_of::as_set<Sequence>::type;
2165
2166 [*Return type]: A __set__ with same elements as the input sequence,
2167 `Sequence`.
2168
2169 [*Semantics]: Convert a fusion sequence, `Sequence`, to a __set__.
2170
2171 [*Precondition]: There may be no duplicate key types.
2172
2173 [heading Header]
2174
2175 #include <boost/fusion/container/set/convert.hpp>
2176 #include <boost/fusion/include/as_set.hpp>
2177
2178 [heading Example]
2179
2180 result_of::as_set<__vector__<char, int> >::type
2181
2182 [endsect]
2183
2184 [section as_map]
2185
2186 [heading Description]
2187
2188 Returns the result type of __as_map__.
2189
2190 [heading Synopsis]
2191
2192 template <typename Sequence>
2193 struct as_map;
2194
2195 [heading Parameters]
2196
2197 [table
2198 [[Parameter] [Requirement] [Description]]
2199 [[`Sequence`] [A fusion __sequence__] [The sequence to convert.]]
2200 ]
2201
2202 [heading Expression Semantics]
2203
2204 result_of::as_map<Sequence>::type;
2205
2206 [*Return type]: A __map__ with same elements as the input sequence,
2207 `Sequence`.
2208
2209 [*Semantics]: Convert a fusion sequence, `Sequence`, to a __map__.
2210
2211 [*Precondition]: For non-associative sequence, the elements are assumed to be
2212 __fusion_pair__s. There may be no duplicate __fusion_pair__ key types.
2213
2214 [heading Header]
2215
2216 #include <boost/fusion/container/map/convert.hpp>
2217 #include <boost/fusion/include/as_map.hpp>
2218
2219 [heading Example]
2220
2221 // from sequence of __fusion_pair__
2222 result_of::as_map<__vector__<
2223 __fusion_pair__<int, char>
2224 , __fusion_pair__<double, std::string> > >::type
2225
2226 // from associative sequence
2227 namespace ns
2228 {
2229 struct x_member;
2230 struct y_member;
2231 }
2232 BOOST_FUSION_DEFINE_ASSOC_STRUCT(
2233 (ns),
2234 point,
2235 (int, x, ns::x_member)
2236 (int, y, ns::y_member)
2237 )
2238 ...
2239 result_of::as_map<ns::point>::type // __map__<__fusion_pair__<ns::x_member, int>, __fusion_pair__<ns::y_member, int> >
2240
2241 [endsect]
2242
2243 [endsect]
2244
2245 [endsect]
2246
2247 [endsect]