1 [/==============================================================================
2 Copyright (C) 2001-2011 Joel de Guzman
3 Copyright (C) 2006 Dan Marsden
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 ===============================================================================/]
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__.
17 #include <boost/fusion/container.hpp>
18 #include <boost/fusion/include/container.hpp>
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.
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>
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>
55 template <typename T0>
58 template <typename T0, typename T1>
61 template <typename T0, typename T1, typename T2>
66 template <typename T0, typename T1, typename T2..., typename TN>
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`.]
77 typename T0 = __unspecified__
78 , typename T1 = __unspecified__
79 , typename T2 = __unspecified__
81 , typename TN = __unspecified__
85 The numbered form accepts the exact number of elements. Example:
87 vector3<int, char, double>
89 For C++11 compilers, the variadic function interface has no upper bound.
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:
95 vector<int, char, double>
97 You may define the preprocessor constant `FUSION_MAX_VECTOR_SIZE` before
98 including any Fusion header to change the default. Example:
100 #define FUSION_MAX_VECTOR_SIZE 20
102 [heading Template parameters]
105 [[Parameter] [Description] [Default]]
106 [[`T0`...`TN`] [Element types] [__unspecified__]]
111 * __random_access_sequence__
113 [variablelist Notation
114 [[`v`] [Instance of `vector`]]
115 [[`V`] [A `vector` type]]
116 [[`e0`...`en`] [Heterogeneous values]]
117 [[`s`] [A __forward_sequence__]]
120 [heading Expression Semantics]
122 Semantics of an expression is defined only where it differs from, or is not
123 defined in __random_access_sequence__.
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`.]]
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;
143 [heading Description]
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__).
155 #include <boost/fusion/container/list/cons.hpp>
156 #include <boost/fusion/include/cons.hpp>
160 template <typename Car, typename Cdr = nil>
163 [heading Template parameters]
166 [[Parameter] [Description] [Default]]
167 [[`Car`] [Head type] [ ]]
168 [[`Cdr`] [Tail type] [`nil`]]
173 * __forward_sequence__
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__]]
185 [heading Expression Semantics]
187 Semantics of an expression is defined only where it differs from, or is not
188 defined in __forward_sequence__.
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__.]]
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__).]
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;
217 [heading Description]
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__).
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>
234 typename T0 = __unspecified__
235 , typename T1 = __unspecified__
236 , typename T2 = __unspecified__
238 , typename TN = __unspecified__
242 For C++11 compilers, the variadic function interface has no upper bound.
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:
248 list<int, char, double>
250 You may define the preprocessor constant `FUSION_MAX_LIST_SIZE` before
251 including any Fusion header to change the default. Example:
253 #define FUSION_MAX_LIST_SIZE 20
255 [heading Template parameters]
258 [[Parameter] [Description] [Default]]
259 [[`T0`...`TN`] [Element types] [__unspecified__]]
264 * __forward_sequence__
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__]]
274 [heading Expression Semantics]
276 Semantics of an expression is defined only where it differs from, or is not
277 defined in __forward_sequence__.
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__.]]
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__).]
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;
304 [heading Description]
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__).
314 Element insertion and removal are done by special `deque` helper classes
315 __front_extended_deque__ and __back_extended_deque__.
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>
326 template <typename ...Elements>
329 For C++11 compilers, the variadic class interface has no upper bound.
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:
335 deque<int, char, double>
337 You may define the preprocessor constant `FUSION_MAX_DEQUE_SIZE` before
338 including any Fusion header to change the default. Example:
340 #define FUSION_MAX_DEQUE_SIZE 20
342 [heading Template parameters]
345 [[Parameter] [Description] [Default]]
346 [[`Elements`] [Element types] [ ]]
351 * __bidirectional_sequence__
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__]]
361 [heading Expression Semantics]
363 Semantics of an expression is defined only where it differs from, or is not
364 defined in __bidirectional_sequence__.
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__.]]
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.]
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;
394 [section front_extended_deque]
396 [heading Description]
398 `front_extended_deque` allows a __deque__ to be front extended. It shares
399 the same properties as the __deque__.
407 template <typename Deque, typename T>
408 struct front_extended_deque;
410 [heading Template parameters]
413 [[Parameter] [Description] [Default]]
414 [[`Deque`] [Deque type] [ ]]
415 [[`T`] [Element type] [ ]]
418 [note `Deque` can be a __deque__, a __front_extended_deque__ or a
419 __back_extended_deque__]
423 * __bidirectional_sequence__
425 [variablelist Notation
426 [[`D`] [A `front_extended_deque` type]]
427 [[`e`] [Heterogeneous value]]
428 [[`N`] [An __mpl_integral_constant__]]
431 [heading Expression Semantics]
433 Semantics of an expression is defined only where it differs from, or is
434 not defined in __bidirectional_sequence__.
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__.]]
442 [note See __deque__ for further details.]
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;
455 [section back_extended_deque]
457 [heading Description]
459 `back_extended_deque` allows a __deque__ to be back extended. It shares
460 the same properties as the __deque__.
468 template <typename Deque, typename T>
469 struct back_extended_deque;
471 [heading Template parameters]
474 [[Parameter] [Description] [Default]]
475 [[`Deque`] [Deque type] [ ]]
476 [[`T`] [Element type] [ ]]
479 [note `Deque` can be a __deque__, a __back_extended_deque__ or a
480 __back_extended_deque__]
484 * __bidirectional_sequence__
486 [variablelist Notation
487 [[`D`] [A `back_extended_deque` type]]
488 [[`e`] [Heterogeneous value]]
489 [[`N`] [An __mpl_integral_constant__]]
492 [heading Expression Semantics]
494 Semantics of an expression is defined only where it differs from, or is
495 not defined in __bidirectional_sequence__.
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__.]]
503 [note See __deque__ for further details.]
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;
518 [heading Description]
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__).
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>
536 typename T0 = __unspecified__
537 , typename T1 = __unspecified__
538 , typename T2 = __unspecified__
540 , typename TN = __unspecified__
544 For C++11 compilers, the variadic function interface has no upper bound.
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:
550 set<int, char, double>
552 You may define the preprocessor constant `FUSION_MAX_SET_SIZE` before
553 including any Fusion header to change the default. Example:
555 #define FUSION_MAX_SET_SIZE 20
557 [heading Template parameters]
560 [[Parameter] [Description] [Default]]
561 [[`T0`...`TN`] [Element types] [__unspecified__]]
566 * __associative_sequence__
567 * __forward_sequence__
569 [variablelist Notation
570 [[`S`] [A `set` type]]
571 [[`s`] [An instance of `set`]]
572 [[`e0`...`en`] [Heterogeneous values]]
573 [[`fs`] [A __forward_sequence__]]
576 [heading Expression Semantics]
578 Semantics of an expression is defined only where it differs from, or is not
579 defined in __random_access_sequence__ and __associative_sequence__.
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`.]]
591 typedef set<int, float> S;
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;
601 [heading Description]
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__).
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>
620 typename T0 = __unspecified__
621 , typename T1 = __unspecified__
622 , typename T2 = __unspecified__
624 , typename TN = __unspecified__
628 For C++11 compilers, the variadic function interface has no upper bound.
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:
634 map<__pair__<int, char>, __pair__<char, char>, __pair__<double, char> >
636 You may define the preprocessor constant `FUSION_MAX_MAP_SIZE` before
637 including any Fusion header to change the default. Example:
639 #define FUSION_MAX_MAP_SIZE 20
641 [heading Template parameters]
644 [[Parameter] [Description] [Default]]
645 [[`T0`...`TN`] [Element types] [__unspecified__]]
650 * __associative_sequence__
651 * __random_access_sequence__
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__]]
660 [heading Expression Semantics]
662 Semantics of an expression is defined only where it differs from, or is not
663 defined in __forward_sequence__ and __associative_sequence__.
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`.]]
677 , __pair__<double, std::string> >
681 __fusion_make_pair__<int>('X')
682 , __fusion_make_pair__<double>("Men"));
684 std::cout << __at_key__<int>(m) << std::endl;
685 std::cout << __at_key__<double>(m) << std::endl;
691 These are the functions that you can use to generate various forms of
692 __containers__ from elemental values.
696 #include <boost/fusion/container/generation.hpp>
697 #include <boost/fusion/include/generation.hpp>
703 [heading Description]
705 Create a __list__ from one or more values.
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);
713 For C++11 compilers, the variadic function interface has no upper bound.
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:
721 #define FUSION_MAX_LIST_SIZE 20
726 [[Parameter] [Requirement] [Description]]
727 [[`x0, x1,... xN`] [Instances of `T0, T1,... TN`] [The arguments to `make_list`]]
730 [heading Expression Semantics]
732 make_list(x0, x1,... xN);
734 [*Return type]: __result_of_make_list__`<T0, T1,... TN>::type`
736 [*Semantics]: Create a __list__ from `x0, x1,... xN`.
740 #include <boost/fusion/container/generation/make_list.hpp>
741 #include <boost/fusion/include/make_list.hpp>
745 make_list(123, "hello", 12.5)
749 __note_ref_wrappers__
755 [heading Description]
757 Create a __cons__ from `car` (/head/) and optional `cdr` (/tail/).
761 template <typename Car>
762 typename __result_of_make_cons__<Car>::type
763 make_cons(Car const& car);
765 template <typename Car, typename Cdr>
766 typename __result_of_make_cons__<Car, Cdr>::type
767 make_cons(Car const& car, Cdr const& cdr);
772 [[Parameter] [Requirement] [Description]]
773 [[`car`] [Instance of `Car`] [The list's head]]
774 [[`cdr`] [Instance of `Cdr`] [The list's tail (optional)]]
777 [heading Expression Semantics]
781 [*Return type]: __result_of_make_cons__`<Car, Cdr>::type` or
782 __result_of_make_cons__`<Car>::type`
784 [*Semantics]: Create a __cons__ from `car` (/head/) and optional `cdr` (/tail/).
788 #include <boost/fusion/container/generation/make_cons.hpp>
789 #include <boost/fusion/include/make_cons.hpp>
793 make_cons('x', make_cons(123))
797 __note_ref_wrappers__
801 [section make_vector]
803 [heading Description]
805 Create a __vector__ from one or more values.
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);
813 For C++11 compilers, the variadic function interface has no upper bound.
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:
821 #define FUSION_MAX_VECTOR_SIZE 20
826 [[Parameter] [Requirement] [Description]]
827 [[`x0, x1,... xN`] [Instances of `T0, T1,... TN`] [The arguments to `make_vector`]]
830 [heading Expression Semantics]
832 make_vector(x0, x1,... xN);
834 [*Return type]: __result_of_make_vector__`<T0, T1,... TN>::type`
836 [*Semantics]: Create a __vector__ from `x0, x1,... xN`.
840 #include <boost/fusion/container/generation/make_vector.hpp>
841 #include <boost/fusion/include/make_vector.hpp>
845 make_vector(123, "hello", 12.5)
849 __note_ref_wrappers__
855 [heading Description]
857 Create a __deque__ from one or more values.
861 template <typename ...Elements>
862 typename __result_of_make_deque__<Elements...>::type
863 make_deque(Elements const&... elements);
865 For C++11 compilers, the variadic function interface has no upper bound.
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:
873 #define FUSION_MAX_DEQUE_SIZE 20
878 [[Parameter] [Description] [Description]]
879 [[`elements`] [Instances of `Elements`] [The arguments to `make_deque`]]
882 [heading Expression Semantics]
884 make_deque(elements...);
886 [*Return type]: __result_of_make_deque__`<Elements...>::type`
888 [*Semantics]: Create a __deque__ from `elements...`.
892 #include <boost/fusion/container/generation/make_deque.hpp>
893 #include <boost/fusion/include/make_deque.hpp>
897 make_deque(123, "hello", 12.5)
901 __note_ref_wrappers__
907 [heading Description]
909 Create a __set__ from one or more values.
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);
917 For C++11 compilers, the variadic function interface has no upper bound.
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:
925 #define FUSION_MAX_SET_SIZE 20
930 [[Parameter] [Requirement] [Description]]
931 [[`x0, x1,... xN`] [Instances of `T0, T1,... TN`] [The arguments to `make_set`]]
934 [heading Expression Semantics]
936 make_set(x0, x1,... xN);
938 [*Return type]: __result_of_make_set__`<T0, T1,... TN>::type`
940 [*Semantics]: Create a __set__ from `x0, x1,... xN`.
942 [*Precondition]: There may be no duplicate key types.
946 #include <boost/fusion/container/generation/make_set.hpp>
947 #include <boost/fusion/include/make_set.hpp>
951 make_set(123, "hello", 12.5)
955 __note_ref_wrappers__
961 [heading Description]
963 Create a __map__ from one or more key/data pairs.
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);
973 For C++11 compilers, the variadic function interface has no upper bound.
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
981 #define FUSION_MAX_MAP_SIZE 20
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`]]
991 [heading Expression Semantics]
993 make_map<K0, K1,... KN>(x0, x1,... xN);
995 [*Return type]: __result_of_make_map__`<K0, K0,... KN, T0, T1,... TN>::type`
997 [*Semantics]: Create a __map__ from `K0, K1,... KN` keys and
998 `x0, x1,... xN` data.
1000 [*Precondition]: There may be no duplicate key types.
1004 #include <boost/fusion/container/generation/make_map.hpp>
1005 #include <boost/fusion/include/make_map.hpp>
1009 make_map<int, double>('X', "Men")
1013 __note_ref_wrappers__, __fusion_pair__
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.
1030 int i; char c; double d;
1032 __vector_tie__(i, c, d);
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`].
1039 A /tie/ can be used to 'unpack' another tuple into variables. E.g.:
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;
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.
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:
1056 __vector_tie__(ignore, c) = __make_vector__(1, 'a');
1062 [heading Description]
1064 Constructs a tie using a __list__ sequence.
1068 template <typename T0, typename T1,... typename TN>
1069 __list__<T0&, T1&,... TN&>
1070 list_tie(T0& x0, T1& x1... TN& xN);
1072 For C++11 compilers, the variadic function interface has no upper bound.
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:
1080 #define FUSION_MAX_LIST_SIZE 20
1082 [heading Parameters]
1085 [[Parameter] [Requirement] [Description]]
1086 [[`x0, x1,... xN`] [Instances of `T0, T1,... TN`] [The arguments to `list_tie`]]
1089 [heading Expression Semantics]
1091 list_tie(x0, x1,... xN);
1093 [*Return type]: __list__<T0&, T1&,... TN&>
1095 [*Semantics]: Create a __list__ of references from `x0, x1,... xN`.
1099 #include <boost/fusion/container/generation/list_tie.hpp>
1100 #include <boost/fusion/include/list_tie.hpp>
1110 [section vector_tie]
1112 [heading Description]
1114 Constructs a tie using a __vector__ sequence.
1118 template <typename T0, typename T1,... typename TN>
1119 __vector__<T0&, T1&,... TN&>
1120 vector_tie(T0& x0, T1& x1... TN& xN);
1122 For C++11 compilers, the variadic function interface has no upper bound.
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:
1130 #define FUSION_MAX_VECTOR_SIZE 20
1132 [heading Parameters]
1135 [[Parameter] [Requirement] [Description]]
1136 [[`x0, x1,... xN`] [Instances of `T0, T1,... TN`] [The arguments to `vector_tie`]]
1139 [heading Expression Semantics]
1141 vector_tie(x0, x1,... xN);
1143 [*Return type]: __vector__<T0&, T1&,... TN&>
1145 [*Semantics]: Create a __vector__ of references from `x0, x1,... xN`.
1149 #include <boost/fusion/container/generation/vector_tie.hpp>
1150 #include <boost/fusion/include/vector_tie.hpp>
1162 [heading Description]
1164 Constructs a tie using a __map__ sequence.
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);
1172 For C++11 compilers, the variadic function interface has no upper bound.
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
1181 #define FUSION_MAX_MAP_SIZE 20
1183 [heading Parameters]
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`]]
1191 [heading Expression Semantics]
1193 map_tie<K0, K1,... KN>(x0, x1,... xN);
1195 [*Return type]: __map__<__pair__<K0, D0&>, __pair__<K1, D1&>,... __pair__<KN, DN&> >
1197 [*Semantics]: Create a __map__ of references from `x0, x1,... xN` with keys `K0, K1,... KN`
1201 #include <boost/fusion/container/generation/map_tie.hpp>
1202 #include <boost/fusion/include/map_tie.hpp>
1211 map_tie<int_key, double_key>(i, d)
1217 [heading Description]
1219 Constructs a tie using a __deque__ sequence.
1223 template <typename ...Elements>
1224 __deque__<Elements&...>
1225 deque_tie(Elements&... elements);
1227 For C++11 compilers, the variadic function interface has no upper bound.
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:
1235 #define FUSION_MAX_DEQUE_SIZE 20
1237 [heading Parameters]
1240 [[Parameter] [Description] [Description]]
1241 [[`elements`] [Instances of `Elements`] [The arguments to `deque_tie`]]
1244 [heading Expression Semantics]
1246 deque_tie(elements...);
1248 [*Return type]: __deque__<Elements&...>
1250 [*Semantics]: Create a __deque__ of references from `elements...`.
1254 #include <boost/fusion/container/generation/deque_tie.hpp>
1255 #include <boost/fusion/include/deque_tie.hpp>
1267 [section MetaFunctions]
1271 [heading Description]
1273 Returns the result type of __make_list__.
1277 template <typename T0, typename T1,... typename TN>
1280 For C++11 compilers, the variadic function interface has no upper bound.
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:
1288 #define FUSION_MAX_LIST_SIZE 20
1290 [heading Parameters]
1293 [[Parameter] [Requirement] [Description]]
1294 [[`T0, T1,... TN`] [Any type] [Template arguments to `make_list`]]
1297 [heading Expression Semantics]
1299 result_of::make_list<T0, T1,... TN>::type
1301 [*Return type]: A __list__ with elements of types converted following the
1302 rules for __element_conversion__.
1304 [*Semantics]: Create a __list__ from `T0, T1,... TN`.
1308 #include <boost/fusion/container/generation/make_list.hpp>
1309 #include <boost/fusion/include/make_list.hpp>
1313 result_of::make_list<int, const char(&)[7], double>::type
1319 [heading Description]
1321 Returns the result type of __make_cons__.
1325 template <typename Car, typename Cdr = nil>
1328 [heading Parameters]
1331 [[Parameter] [Requirement] [Description]]
1332 [[`Car`] [Any type] [The list's head type]]
1333 [[`Cdr`] [A `cons`] [The list's tail type (optional)]]
1336 [heading Expression Semantics]
1338 result_of::make_cons<Car, Cdr>::type
1340 [*Return type]: A __cons__ with head element, `Car`, of type converted
1341 following the rules for __element_conversion__, and tail, `Cdr`.
1343 [*Semantics]: Create a __cons__ from `Car` (/head/) and optional `Cdr` (/tail/).
1347 #include <boost/fusion/container/generation/make_cons.hpp>
1348 #include <boost/fusion/include/make_cons.hpp>
1352 result_of::make_cons<char, result_of::make_cons<int>::type>::type
1356 [section make_vector]
1358 [heading Description]
1360 Returns the result type of __make_vector__.
1364 template <typename T0, typename T1,... typename TN>
1367 For C++11 compilers, the variadic function interface has no upper bound.
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:
1375 #define FUSION_MAX_VECTOR_SIZE 20
1377 [heading Parameters]
1380 [[Parameter] [Requirement] [Description]]
1381 [[`T0, T1,... TN`] [Any type] [Template arguments to `make_vector`]]
1384 [heading Expression Semantics]
1386 result_of::make_vector<T0, T1,... TN>::type
1388 [*Return type]: A __vector__ with elements of types converted following the
1389 rules for __element_conversion__.
1391 [*Semantics]: Create a __vector__ from `T0, T1,... TN`.
1395 #include <boost/fusion/container/generation/make_vector.hpp>
1396 #include <boost/fusion/include/make_vector.hpp>
1400 result_of::make_vector<int, const char(&)[7], double>::type
1404 [section make_deque]
1406 [heading Description]
1408 Returns the result type of __make_deque__.
1412 template <typename ...Elements>
1415 For C++11 compilers, the variadic template interface has no upper bound.
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
1423 #define FUSION_MAX_DEQUE_SIZE 20
1425 [heading Parameters]
1428 [[Parameter] [Requirement] [Description]]
1429 [[`Elements`] [Variadic template types] [Template arguments to `make_deque`]]
1432 [heading Expression Semantics]
1434 result_of::make_deque<Elements...>::type
1436 [*Return type]: A __deque__ with elements of types converted following the
1437 rules for __element_conversion__.
1439 [*Semantics]: Create a __deque__ from `Elements...`.
1443 #include <boost/fusion/container/generation/make_deque.hpp>
1444 #include <boost/fusion/include/make_deque.hpp>
1448 result_of::make_deque<int, const char(&)[7], double>::type
1454 [heading Description]
1456 Returns the result type of __make_set__.
1460 template <typename T0, typename T1,... typename TN>
1463 For C++11 compilers, the variadic function interface has no upper bound.
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:
1471 #define FUSION_MAX_SET_SIZE 20
1473 [heading Parameters]
1476 [[Parameter] [Requirement] [Description]]
1477 [[`T0, T1,... TN`] [Any type] [The arguments to `make_set`]]
1480 [heading Expression Semantics]
1482 result_of::make_set<T0, T1,... TN>::type
1484 [*Return type]: A __set__ with elements of types converted following the
1485 rules for __element_conversion__.
1487 [*Semantics]: Create a __set__ from `T0, T1,... TN`.
1489 [*Precondition]: There may be no duplicate key types.
1493 #include <boost/fusion/container/generation/make_set.hpp>
1494 #include <boost/fusion/include/make_set.hpp>
1498 result_of::make_set<int, char, double>::type
1504 [heading Description]
1506 Returns the result type of __make_map__.
1508 The implementation depends on the support of variadic templates.
1510 When variadic templates are not supported, make_map is a metafunction of the form:
1515 typename K0, typename K1,... typename KN
1516 , typename T0, typename T1,... typename TN>
1519 For C++11 compilers, the variadic function interface has no upper bound.
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
1527 #define FUSION_MAX_MAP_SIZE 20
1529 When variadic templates are supported, make_map is a metafunction class of the form:
1534 typename K0, typename K1,... typename KN>
1538 typename T0, typename T1,... typename TN>
1541 [heading Parameters]
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`]]
1549 [heading Expression Semantics]
1551 #if !defined(BOOST_FUSION_HAS_VARIADIC_MAP)
1552 resulf_of::make_map<K0, K1,... KN, T0, T1,... TN>::type;
1554 resulf_of::make_map<K0, K1,... KN>::apply<T0, T1,... TN>::type;
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.
1562 [*Semantics]: A __map__ with __fusion_pair__ elements where the
1563 `second_type` is converted following the rules for __element_conversion__.
1565 [*Precondition]: There may be no duplicate key types.
1569 #include <boost/fusion/container/generation/make_map.hpp>
1570 #include <boost/fusion/include/make_map.hpp>
1574 #if !defined(BOOST_FUSION_HAS_VARIADIC_MAP)
1575 result_of::make_map<int, double, char, double>::type
1577 result_of::make_map<int, double>::apply<char, double>::type
1588 [heading Description]
1590 Returns the result type of __list_tie__.
1594 template <typename T0, typename T1,... typename TN>
1597 For C++11 compilers, the variadic function interface has no upper bound.
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:
1605 #define FUSION_MAX_LIST_SIZE 20
1607 [heading Parameters]
1610 [[Parameter] [Requirement] [Description]]
1611 [[`T0, T1,... TN`] [Any type] [The arguments to `list_tie`]]
1614 [heading Expression Semantics]
1616 result_of::list_tie<T0, T1,... TN>::type;
1618 [*Return type]: __list__<T0&, T1&,... TN&>
1620 [*Semantics]: Create a __list__ of references from `T0, T1,... TN`.
1624 #include <boost/fusion/container/generation/list_tie.hpp>
1625 #include <boost/fusion/include/list_tie.hpp>
1629 result_of::list_tie<int, double>::type
1633 [section vector_tie]
1635 [heading Description]
1637 Returns the result type of __vector_tie__.
1641 template <typename T0, typename T1,... typename TN>
1644 For C++11 compilers, the variadic function interface has no upper bound.
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:
1652 #define FUSION_MAX_VECTOR_SIZE 20
1654 [heading Parameters]
1657 [[Parameter] [Requirement] [Description]]
1658 [[`T0, T1,... TN`] [Any type] [The arguments to `vector_tie`]]
1661 [heading Expression Semantics]
1663 result_of::vector_tie<T0, T1,... TN>::type;
1665 [*Return type]: __vector__<T0&, T1&,... TN&>
1667 [*Semantics]: Create a __vector__ of references from `T0, T1,... TN`.
1671 #include <boost/fusion/container/generation/vector_tie.hpp>
1672 #include <boost/fusion/include/vector_tie.hpp>
1676 result_of::vector_tie<int, double>::type
1682 [heading Description]
1684 Returns the result type of __deque_tie__.
1688 template <typename ...Elements>
1691 For C++11 compilers, the variadic template interface has no upper bound.
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:
1699 #define FUSION_MAX_DEQUE_SIZE 20
1701 [heading Parameters]
1704 [[Parameter] [Requirement] [Description]]
1705 [[`Elements`] [Variadic template types] [Template arguments to `deque_tie`]]
1708 [heading Expression Semantics]
1710 result_of::deque_tie<Elements...>::type;
1712 [*Return type]: __deque__<Elements&...>
1714 [*Semantics]: Create a __deque__ of references from `Elements...`.
1718 #include <boost/fusion/container/generation/deque_tie.hpp>
1719 #include <boost/fusion/include/deque_tie.hpp>
1723 result_of::deque_tie<int, double>::type
1729 [heading Description]
1731 Returns the result type of __map_tie__.
1735 template <typename K0, typename K1,... typename KN, typename D0, typename D1,... typename DN>
1738 For C++11 compilers, the variadic function interface has no upper bound.
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:
1746 #define FUSION_MAX_MAP_SIZE 20
1748 [heading Parameters]
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`]]
1756 [heading Expression Semantics]
1758 result_of::map_tie<K0, K1,... KN, D0, D1,... DN>::type;
1760 [*Return type]: __map__<__pair__<K0, D0&>, __pair__<K1, D1&>,... __pair__<KN, DN&> >
1762 [*Semantics]: Create a __map__ of references from `D0, D1,... DN` with keys `K0, K1,... KN`
1766 #include <boost/fusion/container/generation/map_tie.hpp>
1767 #include <boost/fusion/include/map_tie.hpp>
1774 result_of::map_tie<int_key, double_key, int, double>::type
1782 [section Conversion]
1784 All fusion sequences can be converted to one of the __containers__ types
1785 using one of these conversion functions.
1789 #include <boost/fusion/include/convert.hpp>
1795 [heading Description]
1797 Convert a fusion sequence to a __list__.
1801 template <typename Sequence>
1802 typename result_of::as_list<Sequence>::type
1803 as_list(Sequence& seq);
1805 template <typename Sequence>
1806 typename result_of::as_list<Sequence const>::type
1807 as_list(Sequence const& seq);
1809 [heading Parameters]
1812 [[Parameter] [Requirement] [Description]]
1813 [[`seq`] [An instance of Sequence] [The sequence to convert.]]
1816 [heading Expression Semantics]
1820 [*Return type]: __result_of_as_list__`<Sequence>::type`
1822 [*Semantics]: Convert a fusion sequence, `seq`, to a __list__.
1826 #include <boost/fusion/container/list/convert.hpp>
1827 #include <boost/fusion/include/as_list.hpp>
1831 as_list(__make_vector__('x', 123, "hello"))
1837 [heading Description]
1839 Convert a fusion sequence to a __vector__.
1843 template <typename Sequence>
1844 typename result_of::as_vector<Sequence>::type
1845 as_vector(Sequence& seq);
1847 template <typename Sequence>
1848 typename result_of::as_vector<Sequence const>::type
1849 as_vector(Sequence const& seq);
1851 [heading Parameters]
1854 [[Parameter] [Requirement] [Description]]
1855 [[`seq`] [An instance of Sequence] [The sequence to convert.]]
1858 [heading Expression Semantics]
1862 [*Return type]: __result_of_as_vector__`<Sequence>::type`
1864 [*Semantics]: Convert a fusion sequence, `seq`, to a __vector__.
1868 #include <boost/fusion/container/vector/convert.hpp>
1869 #include <boost/fusion/include/as_vector.hpp>
1873 as_vector(__make_list__('x', 123, "hello"))
1879 [heading Description]
1881 Convert a fusion sequence to a __deque__.
1885 template <typename Sequence>
1886 typename result_of::as_deque<Sequence>::type
1887 as_deque(Sequence& seq);
1889 template <typename Sequence>
1890 typename result_of::as_deque<Sequence const>::type
1891 as_deque(Sequence const& seq);
1893 [heading Parameters]
1896 [[Parameter] [Requirement] [Description]]
1897 [[`seq`] [An instance of Sequence] [The sequence to convert.]]
1900 [heading Expression Semantics]
1904 [*Return type]: __result_of_as_deque__`<Sequence>::type`
1906 [*Semantics]: Convert a fusion sequence, `seq`, to a __deque__.
1910 #include <boost/fusion/container/deque/convert.hpp>
1911 #include <boost/fusion/include/as_deque.hpp>
1915 as_deque(__make_vector__('x', 123, "hello"))
1921 [heading Description]
1923 Convert a fusion sequence to a __set__.
1927 template <typename Sequence>
1928 typename result_of::as_set<Sequence>::type
1929 as_set(Sequence& seq);
1931 template <typename Sequence>
1932 typename result_of::as_set<Sequence const>::type
1933 as_set(Sequence const& seq);
1935 [heading Parameters]
1938 [[Parameter] [Requirement] [Description]]
1939 [[`seq`] [An instance of Sequence] [The sequence to convert.]]
1942 [heading Expression Semantics]
1946 [*Return type]: __result_of_as_set__`<Sequence>::type`
1948 [*Semantics]: Convert a fusion sequence, `seq`, to a __set__.
1950 [*Precondition]: There may be no duplicate key types.
1954 #include <boost/fusion/container/set/convert.hpp>
1955 #include <boost/fusion/include/as_set.hpp>
1959 as_set(__make_vector__('x', 123, "hello"))
1965 [heading Description]
1967 Convert a fusion sequence to a __map__.
1971 template <typename Sequence>
1972 typename result_of::as_map<Sequence>::type
1973 as_map(Sequence& seq);
1975 template <typename Sequence>
1976 typename result_of::as_map<Sequence const>::type
1977 as_map(Sequence const& seq);
1979 [heading Parameters]
1982 [[Parameter] [Requirement] [Description]]
1983 [[`seq`] [An instance of Sequence] [The sequence to convert.]]
1986 [heading Expression Semantics]
1990 [*Return type]: __result_of_as_map__`<Sequence>::type`
1992 [*Semantics]: Convert a fusion sequence, `seq`, to a __map__.
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.
1999 #include <boost/fusion/container/map/convert.hpp>
2000 #include <boost/fusion/include/as_map.hpp>
2004 // from sequence of __fusion_pair__
2005 as_map(__make_vector__(
2006 __fusion_make_pair__<int>('X')
2007 , __fusion_make_pair__<double>("Men")))
2009 // from associative sequence
2015 BOOST_FUSION_DEFINE_ASSOC_STRUCT(
2018 (int, x, ns::x_member)
2019 (int, y, ns::y_member)
2022 as_map(ns::point(123, 456))
2028 [section Metafunctions]
2032 [heading Description]
2034 Returns the result type of __as_list__.
2038 template <typename Sequence>
2041 [heading Parameters]
2044 [[Parameter] [Requirement] [Description]]
2045 [[`Sequence`] [A fusion __sequence__] [The sequence type to convert.]]
2048 [heading Expression Semantics]
2050 result_of::as_list<Sequence>::type;
2052 [*Return type]: A __list__ with same elements as the input sequence,
2055 [*Semantics]: Convert a fusion sequence, `Sequence`, to a __list__.
2059 #include <boost/fusion/container/list/convert.hpp>
2060 #include <boost/fusion/include/as_list.hpp>
2064 result_of::as_list<__vector__<char, int> >::type
2070 [heading Description]
2072 Returns the result type of __as_vector__.
2076 template <typename Sequence>
2079 [heading Parameters]
2082 [[Parameter] [Requirement] [Description]]
2083 [[`Sequence`] [A fusion __sequence__] [The sequence to convert.]]
2086 [heading Expression Semantics]
2088 result_of::as_vector<Sequence>::type;
2090 [*Return type]: A __vector__ with same elements as the input sequence,
2093 [*Semantics]: Convert a fusion sequence, `Sequence`, to a __vector__.
2097 #include <boost/fusion/container/vector/convert.hpp>
2098 #include <boost/fusion/include/as_vector.hpp>
2102 result_of::as_vector<__list__<char, int> >::type
2108 [heading Description]
2110 Returns the result type of __as_deque__.
2114 template <typename Sequence>
2117 [heading Parameters]
2120 [[Parameter] [Requirement] [Description]]
2121 [[`Sequence`] [A fusion __sequence__] [The sequence type to convert.]]
2124 [heading Expression Semantics]
2126 result_of::as_deque<Sequence>::type;
2128 [*Return type]: A __deque__ with same elements as the input sequence,
2131 [*Semantics]: Convert a fusion sequence, `Sequence`, to a __deque__.
2135 #include <boost/fusion/container/deque/convert.hpp>
2136 #include <boost/fusion/include/as_deque.hpp>
2140 result_of::as_deque<__vector__<char, int> >::type
2146 [heading Description]
2148 Returns the result type of __as_set__.
2152 template <typename Sequence>
2155 [heading Parameters]
2158 [[Parameter] [Requirement] [Description]]
2159 [[`Sequence`] [A fusion __sequence__] [The sequence to convert.]]
2162 [heading Expression Semantics]
2164 result_of::as_set<Sequence>::type;
2166 [*Return type]: A __set__ with same elements as the input sequence,
2169 [*Semantics]: Convert a fusion sequence, `Sequence`, to a __set__.
2171 [*Precondition]: There may be no duplicate key types.
2175 #include <boost/fusion/container/set/convert.hpp>
2176 #include <boost/fusion/include/as_set.hpp>
2180 result_of::as_set<__vector__<char, int> >::type
2186 [heading Description]
2188 Returns the result type of __as_map__.
2192 template <typename Sequence>
2195 [heading Parameters]
2198 [[Parameter] [Requirement] [Description]]
2199 [[`Sequence`] [A fusion __sequence__] [The sequence to convert.]]
2202 [heading Expression Semantics]
2204 result_of::as_map<Sequence>::type;
2206 [*Return type]: A __map__ with same elements as the input sequence,
2209 [*Semantics]: Convert a fusion sequence, `Sequence`, to a __map__.
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.
2216 #include <boost/fusion/container/map/convert.hpp>
2217 #include <boost/fusion/include/as_map.hpp>
2221 // from sequence of __fusion_pair__
2222 result_of::as_map<__vector__<
2223 __fusion_pair__<int, char>
2224 , __fusion_pair__<double, std::string> > >::type
2226 // from associative sequence
2232 BOOST_FUSION_DEFINE_ASSOC_STRUCT(
2235 (int, x, ns::x_member)
2236 (int, y, ns::y_member)
2239 result_of::as_map<ns::point>::type // __map__<__fusion_pair__<ns::x_member, int>, __fusion_pair__<ns::y_member, int> >