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 Like __mpl__ and __stl__, iterators are a fundamental concept in Fusion.
12 As with __mpl__ and __stl__ iterators describe positions, and
13 provide access to data within an underlying __sequence__.
16 #include <boost/fusion/iterator.hpp>
17 #include <boost/fusion/include/iterator.hpp>
21 Fusion iterators are divided into different traversal categories.
22 __forward_iterator__ is the most basic concept. __bidirectional_iterator__
23 is a refinement of __forward_iterator__. __random_access_iterator__ is a
24 refinement of __bidirectional_iterator__. __associative_iterator__ is a
25 refinement of __forward_iterator__, __bidirectional_iterator__ or
26 __random_access_iterator__.
28 [section Forward Iterator]
31 A Forward Iterator traverses a __sequence__ allowing movement in only one direction through
32 it's elements, one element at a time.
34 [variablelist Notation
35 [[`i`, `j`] [Forward Iterators]]
36 [[`I`, `J`] [Forward Iterator types]]
37 [[`M`] [An __mpl__ integral constant]]
38 [[`N`] [An integral constant]]
41 [heading Expression requirements]
42 A type models Forward Iterator if, in addition to being CopyConstructable,
43 the following expressions are valid:
46 [[Expression] [Return type] [Runtime Complexity]]
47 [[`__next__(i)`] [__forward_iterator__] [Constant]]
48 [[`i == j`] [Convertible to bool] [Constant]]
49 [[`i != j`] [Convertible to bool] [Constant]]
50 [[`__advance_c__<N>(i)`] [__forward_iterator__] [Constant]]
51 [[`__advance__<M>(i)`] [__forward_iterator__] [Constant]]
52 [[`__distance__(i, j)`] [`__result_of_distance__<I, J>::type`][Constant]]
53 [[`__deref__(i)`] [`__result_of_deref__<I>::type`] [Constant]]
54 [[`*i`] [`__result_of_deref__<I>::type`] [Constant]]
57 [heading Meta Expressions]
59 [[Expression] [Compile Time Complexity]]
60 [[`__result_of_next__<I>::type`] [Amortized constant time]]
61 [[`__result_of_equal_to__<I, J>::type`] [Amortized constant time]]
62 [[`__result_of_advance_c__<I, N>::type`] [Linear]]
63 [[`__result_of_advance__<I ,M>::type`] [Linear]]
64 [[`__result_of_distance__<I ,J>::type`] [Linear]]
65 [[`__result_of_deref__<I>::type`] [Amortized constant time]]
66 [[`__result_of_value_of__<I>::type`] [Amortized constant time]]
69 [heading Expression Semantics]
71 [[Expression] [Semantics]]
72 [[`__next__(i)`] [An iterator to the element following `i`]]
73 [[`i == j`] [Iterator equality comparison]]
74 [[`i != j`] [Iterator inequality comparison]]
75 [[`__advance_c__<N>(i)`] [An iterator n elements after `i` in the sequence]]
76 [[`__advance__<M>(i)`] [Equivalent to `advance_c<M::value>(i)`]]
77 [[`__distance__(i, j)`] [The number of elements between `i` and `j`]]
78 [[`__deref__(i)`] [The element at position`i`]]
79 [[`*i`] [Equivalent to `deref(i)`]]
83 The following invariants always hold:
85 * `!(i == j) == (i != j)`
86 * `__next__(i) == __advance_c__<1>(i)`
87 * `__distance__(i, __advance_c__<N>(i)) == N`
88 * Using `__next__` to traverse the sequence will never return to a previously seen position
89 * `__deref__(i)` is equivalent to `*i`
90 * If `i == j` then `*i` is equivalent to `*j`
93 * __std_pair__ iterator
94 * __boost_array__ iterator
100 * __single_view__ iterator
101 * __filter_view__ iterator
102 * __iterator_range__ iterator
103 * __joint_view__ iterator
104 * __transform_view__ iterator
105 * __reverse_view__ iterator
109 [section Bidirectional Iterator]
110 [heading Description]
111 A Bidirectional Iterator traverses a __sequence__ allowing movement in either direction one
114 [variablelist Notation
115 [[`i`] [A Bidirectional Iterator]]
116 [[`I`] [A Bidirectional Iterator type]]
117 [[`M`] [An __mpl__ integral constant]]
118 [[`N`] [An integral constant]]
121 [heading Refinement of]
124 [heading Expression requirements]
125 In addition to the requirements defined in __forward_iterator__,
126 the following expressions must be valid:
129 [[Expression] [Return type] [Runtime Complexity]]
130 [[`__next__(i)`] [__bidirectional_iterator__] [Constant]]
131 [[`__prior__(i)`] [__bidirectional_iterator__] [Constant]]
132 [[`__advance_c__<N>(i)`] [__bidirectional_iterator__] [Constant]]
133 [[`__advance__<M>(i)`] [__bidirectional_iterator__] [Constant]]
136 [heading Meta Expressions]
138 [[Expression] [Compile Time Complexity]]
139 [[`__result_of_prior__<I>::type`] [Amortized constant time]]
142 [heading Expression Semantics]
143 The semantics of an expression are defined only where they differ from, or are not defined
144 in __forward_iterator__
147 [[Expression] [Semantics]]
148 [[`__prior__(i)`] [An iterator to the element preceding `i`]]
152 In addition to the invariants of __forward_iterator__,
153 the following invariants always hold:
155 * `__prior__(__next__(i)) == i && __prior__(__next__(i)) == __next__(__prior__(i))`
156 * `__prior__(i) == __advance_c__<-1>(i)`
157 * Using `__prior__` to traverse a sequence will never return a previously seen position
160 * __std_pair__ iterator
161 * __boost_array__ iterator
162 * __vector__ iterator
164 * __single_view__ iterator
165 * __iterator_range__ (where adapted sequence is a __bidirectional_sequence__)
166 * __transform_view__ (where adapted sequence is a __bidirectional_sequence__)
171 [section Random Access Iterator]
172 [heading Description]
173 A Random Access Iterator traverses a __sequence__ moving in either direction,
174 permitting efficient arbitrary distance movements back and forward through the
177 [variablelist Notation
178 [[`i`, `j`] [Random Access Iterators]]
179 [[`I`, `J`] [Random Access Iterator types]]
180 [[`M`] [An __mpl__ integral constant]]
181 [[`N`] [An integral constant]]
184 [heading Refinement of]
185 __bidirectional_iterator__
187 [heading Expression requirements]
188 In addition to the requirements defined in __bidirectional_iterator__,
189 the following expressions must be valid:
192 [[Expression] [Return type] [Runtime Complexity]]
193 [[`__next__(i)`] [__random_access_iterator__] [Constant]]
194 [[`__prior__(i)`] [__random_access_iterator__] [Constant]]
195 [[`__advance_c__<N>(i)`] [__random_access_iterator__] [Constant]]
196 [[`__advance__<M>(i)`] [__random_access_iterator__] [Constant]]
199 [heading Meta Expressions]
201 [[Expression] [Compile Time Complexity]]
202 [[`__result_of_advance_c__<I, N>::type`] [Amortized constant time]]
203 [[`__result_of_advance__<I, M>::type`] [Amortized constant time]]
204 [[`__result_of_distance__<I ,J>::type`] [Amortized constant time]]
208 * __vector__ iterator
210 * __std_pair__ iterator
211 * __boost_array__ iterator
212 * __single_view__ iterator
213 * __iterator_range__ iterator (where adapted sequence is a __random_access_sequence__)
214 * __transform_view__ iterator (where adapted sequence is a __random_access_sequence__)
215 * __reverse_view__ iterator (where adapted sequence is a __random_access_sequence__)
219 [section Associative Iterator]
220 [heading Description]
221 An Associative Iterator provides additional semantics to obtain the properties
222 of the element of an associative forward, bidirectional or random access sequence.
224 [variablelist Notation
225 [[`i`] [Associative Iterator]]
226 [[`I`] [Associative Iterator type]]
229 [heading Refinement of]
230 __forward_iterator__, __bidirectional_iterator__ or __random_access_iterator__
232 [heading Expression requirements]
233 In addition to the requirements defined in __forward_iterator__,
234 __bidirectional_iterator__ or __random_access_iterator__ the following
235 expressions must be valid:
238 [[Expression] [Return type] [Runtime Complexity]]
239 [[`__deref_data__(i)`][`__result_of_deref_data__<I>::type`][Constant]]
242 [heading Meta Expressions]
244 [[Expression] [Compile Time Complexity]]
245 [[`__result_of_key_of__<I>::type`][Amortized constant time]]
246 [[`__result_of_value_of_data__<I>::type`][Amortized constant time]]
247 [[`__result_of_deref_data__<I>::type`][Amortized constant time]]
253 * __filter_view__ iterator (where adapted sequence is an __associative_sequence__ and a __forward_sequence__)
254 * __iterator_range__ iterator (where adapted iterators are __associative_iterator__\ s)
255 * __joint_view__ iterator (where adapted sequences are __associative_sequence__\ s and __forward_sequence__\ s)
256 * __reverse_view__ iterator (where adapted sequence is an __associative_sequence__ and a __bidirectional_sequence__)
260 [section Unbounded Iterator]
262 [warning In this release, __unbounded_iterator__ concept has no effect. It's reserved for future release.]
269 Fusion provides functions for manipulating iterators, analogous to the similar functions
270 from the __mpl__ library.
274 [heading Description]
275 Deferences an iterator.
281 typename __result_of_deref__<I>::type deref(I const& i);
284 [[Parameter] [Requirement] [Description]]
285 [[`i`] [Model of __forward_iterator__] [Operation's argument]]
288 [heading Expression Semantics]
291 [*Return type]: `__result_of_deref__<I>::type`
293 [*Semantics]: Dereferences the iterator `i`.
296 #include <boost/fusion/iterator/deref.hpp>
297 #include <boost/fusion/include/deref.hpp>
300 typedef __vector__<int,int&> vec;
304 assert(__deref__(__begin__(v)) == 1);
305 assert(__deref__(__next__(__begin__(v))) == 0);
306 assert(&(__deref__(__next__(__begin__(v)))) == &i);
312 [heading Description]
313 Moves an iterator 1 position forwards.
319 typename __result_of_next__<I>::type next(I const& i);
322 [[Parameter] [Requirement] [Description]]
323 [[`i`] [Model of __forward_iterator__] [Operation's argument]]
326 [heading Expression Semantics]
329 [*Return type]: A model of the same iterator concept as `i`.
331 [*Semantics]: Returns an iterator to the next element after `i`.
334 #include <boost/fusion/iterator/next.hpp>
335 #include <boost/fusion/include/next.hpp>
338 typedef __vector__<int,int,int> vec;
341 assert(__deref__(__begin__(v)) == 1);
342 assert(__deref__(__next__(__begin__(v))) == 2);
343 assert(__deref__(__next__(__next__(__begin__(v)))) == 3);
349 [heading Description]
350 Moves an iterator 1 position backwards.
356 typename __result_of_prior__<I>::type prior(I const& i);
359 [[Parameter] [Requirement] [Description]]
360 [[`i`] [Model of __bidirectional_iterator__] [Operation's argument]]
363 [heading Expression Semantics]
366 [*Return type]: A model of the same iterator concept as `i`.
368 [*Semantics]: Returns an iterator to the element prior to `i`.
371 #include <boost/fusion/iterator/prior.hpp>
372 #include <boost/fusion/include/prior.hpp>
375 typedef __vector__<int,int> vec;
378 assert(__deref__(__next__(__begin__(v))) == 2);
379 assert(__deref__(__prior__(__next__(__begin__(v)))) == 1);
385 [heading Description]
386 Returns the distance between 2 iterators.
393 typename __result_of_distance__<I, J>::type distance(I const& i, J const& j);
396 [[Parameter] [Requirement] [Description]]
397 [[`i`, `j`] [Models of __forward_iterator__ into the same sequence] [The start and end points of the distance to be measured]]
400 [heading Expression Semantics]
403 [*Return type]: `int`
405 [*Semantics]: Returns the distance between iterators `i` and `j`.
408 #include <boost/fusion/iterator/distance.hpp>
409 #include <boost/fusion/include/distance.hpp>
412 typedef __vector__<int,int,int> vec;
415 assert(__distance__(__begin__(v), __next__(__next__(__begin__(v)))) == 2);
421 [heading Description]
422 Moves an iterator by a specified distance.
429 typename __result_of_advance__<I, M>::type advance(I const& i);
432 [[Parameter] [Requirement] [Description]]
433 [[`i`] [Model of __forward_iterator__] [Iterator to move relative to]]
434 [[`M`] [An __mpl_integral_constant__] [Number of positions to move]]
437 [heading Expression Semantics]
440 [*Return type]: A model of the same iterator concept as `i`.
442 [*Semantics]: Returns an iterator to the element `M` positions from `i`. If `i` is a __bidirectional_iterator__ then `M` may be negative.
445 #include <boost/fusion/iterator/advance.hpp>
446 #include <boost/fusion/include/advance.hpp>
449 typedef __vector__<int,int,int> vec;
452 assert(__deref__(__advance__<mpl::int_<2> >(__begin__(v))) == 3);
458 [heading Description]
459 Moves an iterator by a specified distance.
466 typename __result_of_advance_c__<I, N>::type advance_c(I const& i);
469 [[Parameter] [Requirement] [Description]]
470 [[`i`] [Model of __forward_iterator__] [Iterator to move relative to]]
471 [[`N`] [Integer constant] [Number of positions to move]]
474 [heading Expression Semantics]
477 [*Return type]: A model of the same iterator concept as `i`.
479 [*Semantics]: Returns an iterator to the element `N` positions from `i`. If `i` is a __bidirectional_iterator__ then `N` may be negative.
482 #include <boost/fusion/iterator/advance.hpp>
483 #include <boost/fusion/include/advance.hpp>
486 typedef __vector__<int,int,int> vec;
489 assert(__deref__(__advance_c__<2>(__begin__(v))) == 3);
495 [heading Description]
496 Deferences the data property associated with the element referenced by an associative iterator.
502 typename __result_of_deref_data__<I>::type deref_data(I const& i);
505 [[Parameter] [Requirement] [Description]]
506 [[`i`] [Model of __associative_iterator__] [Operation's argument]]
509 [heading Expression Semantics]
512 [*Return type]: `__result_of_deref_data__<I>::type`
514 [*Semantics]: Dereferences the data property associated with the element referenced by an associative iterator `i`.
517 #include <boost/fusion/iterator/deref_data.hpp>
518 #include <boost/fusion/include/deref_data.hpp>
521 typedef __map__<__pair__<float, int&> > map;
525 assert(__deref_data__(__begin__(m)) == 0);
526 assert(&(__deref_data__(__begin__(m))) == &i);
534 Overloaded operators are provided to provide a more natural syntax for dereferencing iterators, and comparing them for equality.
536 [section:operator_unary_star Operator *]
538 [heading Description]
539 Dereferences an iterator.
545 typename __result_of_deref__<I>::type operator*(I const& i);
548 [[Parameter] [Requirement] [Description]]
549 [[`i`] [Model of __forward_iterator__] [Operation's argument]]
552 [heading Expression Semantics]
555 [*Return type]: Equivalent to the return type of `__deref__(i)`.
557 [*Semantics]: Equivalent to `__deref__(i)`.
560 #include <boost/fusion/iterator/deref.hpp>
561 #include <boost/fusion/include/deref.hpp>
564 typedef __vector__<int,int&> vec;
568 assert(*__begin__(v) == 1);
569 assert(*__next__(__begin__(v)) == 0);
570 assert(&(*__next__(__begin__(v))) == &i);
574 [section:operator_equality Operator ==]
576 [heading Description]
577 Compares 2 iterators for equality.
584 __unspecified__ operator==(I const& i, J const& i);
587 [[Parameter] [Requirement] [Description]]
588 [[`i`, `j`] [Any fusion iterators] [Operation's arguments]]
591 [heading Expression Semantics]
594 [*Return type]: Convertible to `bool`.
596 [*Semantics]: Equivalent to `__result_of_equal_to__<I,J>::value` where `I` and `J` are the types of `i` and `j` respectively.
599 #include <boost/fusion/iterator/equal_to.hpp>
600 #include <boost/fusion/include/equal_to.hpp>
604 [section:operator_inequality Operator !=]
606 [heading Description]
607 Compares 2 iterators for inequality.
614 __unspecified__ operator==(I const& i, J const& i);
617 [[Parameter] [Requirement] [Description]]
618 [[`i`, `j`] [Any fusion iterators] [Operation's arguments]]
621 [heading Expression Semantics]
623 [*Return type]: Convertible to `bool`.
625 [*Semantics]: Equivalent to `!__result_of_equal_to__<I,J>::value` where `I` and `J` are the types of `i` and `j` respectively.
628 #include <boost/fusion/iterator/equal_to.hpp>
629 #include <boost/fusion/include/equal_to.hpp>
635 [section Metafunctions]
639 [heading Description]
641 Returns the type stored at the position of an iterator.
649 typedef __unspecified__ type;
653 [[Parameter] [Requirement] [Description]]
654 [[`I`] [Model of __forward_iterator__] [Operation's argument]]
657 [heading Expression Semantics]
658 __result_of_value_of__<I>::type
660 [*Return type]: Any type
662 [*Semantics]: Returns the type stored in a sequence at iterator position `I`.
665 #include <boost/fusion/iterator/value_of.hpp>
666 #include <boost/fusion/include/value_of.hpp>
669 typedef __vector__<int,int&,const int&> vec;
670 typedef __result_of_begin__<vec>::type first;
671 typedef __result_of_next__<first>::type second;
672 typedef __result_of_next__<second>::type third;
674 BOOST_MPL_ASSERT((boost::is_same<__result_of_value_of__<first>::type, int>));
675 BOOST_MPL_ASSERT((boost::is_same<__result_of_value_of__<second>::type, int&>));
676 BOOST_MPL_ASSERT((boost::is_same<__result_of_value_of__<third>::type, const int&>));
682 [heading Description]
683 Returns the type that will be returned by dereferencing an iterator.
691 typedef __unspecified__ type;
695 [[Parameter] [Requirement] [Description]]
696 [[`I`] [Model of __forward_iterator__] [Operation's argument]]
699 [heading Expression Semantics]
700 __result_of_deref__<I>::type
702 [*Return type]: Any type
704 [*Semantics]: Returns the result of dereferencing an iterator of type `I`.
707 #include <boost/fusion/iterator/deref.hpp>
708 #include <boost/fusion/include/deref.hpp>
711 typedef __vector__<int,int&> vec;
712 typedef const vec const_vec;
713 typedef __result_of_begin__<vec>::type first;
714 typedef __result_of_next__<first>::type second;
716 typedef __result_of_begin__<const_vec>::type const_first;
717 typedef __result_of_next__<const_first>::type const_second;
719 BOOST_MPL_ASSERT((boost::is_same<__result_of_deref__<first>::type, int&>));
720 BOOST_MPL_ASSERT((boost::is_same<__result_of_deref__<second>::type, int&>));
726 [heading Description]
727 Returns the type of the next iterator in a sequence.
735 typedef __unspecified__ type;
739 [[Parameter] [Requirement] [Description]]
740 [[`I`] [Model of __forward_iterator__] [Operation's argument]]
743 [heading Expression Semantics]
744 __result_of_next__<I>::type
746 [*Return type]: A model of the same iterator concept as `I`.
748 [*Semantics]: Returns an iterator to the next element in the sequence after `I`.
751 #include <boost/fusion/iterator/next.hpp>
752 #include <boost/fusion/include/next.hpp>
755 typedef __vector__<int,double> vec;
756 typedef __result_of_next__<__result_of_begin__<vec>::type>::type second;
758 BOOST_MPL_ASSERT((boost::is_same<__result_of_value_of__<second>::type, double>));
764 [heading Description]
765 Returns the type of the previous iterator in a sequence.
773 typedef __unspecified__ type;
777 [[Parameter] [Requirement] [Description]]
778 [[`I`] [Model of __bidirectional_iterator__] [Operation's argument]]
781 [heading Expression Semantics]
782 __result_of_prior__<I>::type
784 [*Return type]: A model of the same iterator concept as `I`.
786 [*Semantics]: Returns an iterator to the previous element in the sequence before `I`.
789 #include <boost/fusion/iterator/prior.hpp>
790 #include <boost/fusion/include/prior.hpp>
793 typedef __vector__<int,double> vec;
794 typedef __result_of_next__<__result_of_begin__<vec>::type>::type second;
796 BOOST_MPL_ASSERT((boost::is_same<__result_of_value_of__<second>::type, double>));
798 typedef __result_of_prior__<second>::type first;
799 BOOST_MPL_ASSERT((boost::is_same<__result_of_value_of__<first>::type, int>));
805 [heading Description]
806 Returns a true-valued __mpl_integral_constant__ if `I` and `J` are equal.
815 typedef __unspecified__ type;
819 [[Parameter] [Requirement] [Description]]
820 [[`I`, `J`] [Any fusion iterators] [Operation's arguments]]
823 [heading Expression Semantics]
824 __result_of_equal_to__<I, J>::type
826 [*Return type]: A model of __mpl_integral_constant__.
828 [*Semantics]: Returns `boost::mpl::true_` if `I` and `J` are iterators to the same position. Returns `boost::mpl::false_` otherwise.
831 #include <boost/fusion/iterator/equal_to.hpp>
832 #include <boost/fusion/include/equal_to.hpp>
835 typedef __vector__<int,double> vec;
836 typedef __result_of_begin__<vec>::type first;
837 typedef __result_of_end__<vec>::type last;
838 BOOST_MPL_ASSERT((__result_of_equal_to__<first, first>));
839 BOOST_MPL_ASSERT_NOT((__result_of_equal_to__<first,last>));
845 [heading Description]
846 Returns the distance between two iterators.
855 typedef __unspecified__ type;
859 [[Parameter] [Requirement] [Description]]
860 [[`I`, `J`] [Models of __forward_iterator__ into the same sequence] [The start and end points of the distance to be measured]]
863 [heading Expression Semantics]
864 __result_of_distance__<I, J>::type
866 [*Return type]: A model of __mpl_integral_constant__.
868 [*Semantics]: Returns the distance between iterators of types `I` and `J`.
871 #include <boost/fusion/iterator/distance.hpp>
872 #include <boost/fusion/include/distance.hpp>
875 typedef __vector__<int,double,char> vec;
876 typedef __result_of_begin__<vec>::type first;
877 typedef __result_of_next__<first>::type second;
878 typedef __result_of_next__<second>::type third;
879 typedef __result_of_distance__<first,third>::type dist;
881 BOOST_MPL_ASSERT_RELATION(dist::value, ==, 2);
887 [heading Description]
888 Moves an iterator a specified distance.
897 typedef __unspecified__ type;
901 [[Parameter] [Requirement] [Description]]
902 [[`I`] [Model of __forward_iterator__] [Iterator to move relative to]]
903 [[`M`] [Model of __mpl_integral_constant__] [Number of positions to move]]
906 [heading Expression Semantics]
907 __result_of_advance__<I,M>::type
909 [*Return type]: A model of the same iterator concept as `I`.
911 [*Semantics]: Returns an iterator a distance `M` from `I`. If `I` is a __bidirectional_iterator__ then `M` may be negative.
914 #include <boost/fusion/iterator/advance.hpp>
915 #include <boost/fusion/include/advance.hpp>
918 typedef __vector__<int,double,char> vec;
919 typedef __result_of_begin__<vec>::type first;
920 typedef __result_of_next__<first>::type second;
921 typedef __result_of_next__<second>::type third;
923 BOOST_MPL_ASSERT((__result_of_equal_to__<__result_of_advance__<first, boost::mpl::int_<2> >::type, third>));
929 [heading Description]
930 Moves an iterator by a specified distance.
939 typedef __unspecified__ type;
943 [[Parameter] [Requirement] [Description]]
944 [[`I`] [Model of __forward_iterator__] [Iterator to move relative to]]
945 [[`N`] [Integer constant] [Number of positions to move]]
948 [heading Expression Semantics]
949 __result_of_advance_c__<I, N>::type
951 [*Return type]: A model of the same iterator concept as `I`.
953 [*Semantics]: Returns an iterator a distance `N` from `I`. If `I` is a __bidirectional_iterator__ then `N` may be negative. Equivalent to `__result_of_advance__<I, boost::mpl::int_<N> >::type`.
956 #include <boost/fusion/iterator/advance.hpp>
957 #include <boost/fusion/include/advance.hpp>
960 typedef __vector__<int,double,char> vec;
961 typedef __result_of_begin__<vec>::type first;
962 typedef __result_of_next__<first>::type second;
963 typedef __result_of_next__<second>::type third;
965 BOOST_MPL_ASSERT((__result_of_equal_to__<__result_of_advance_c__<first, 2>::type, third>));
971 [heading Description]
973 Returns the key type associated with the element referenced by an associative iterator.
981 typedef __unspecified__ type;
985 [[Parameter] [Requirement] [Description]]
986 [[`I`] [Model of __associative_iterator__] [Operation's argument]]
989 [heading Expression Semantics]
990 __result_of_key_of__<I>::type
992 [*Return type]: Any type
994 [*Semantics]: Returns the key type associated with the element referenced by an associative iterator `I`.
997 #include <boost/fusion/iterator/key_of.hpp>
998 #include <boost/fusion/include/key_of.hpp>
1001 typedef __map__<__pair__<float,int> > vec;
1002 typedef __result_of_begin__<vec>::type first;
1004 BOOST_MPL_ASSERT((boost::is_same<__result_of_key_of__<first>::type, float>));
1008 [section value_of_data]
1010 [heading Description]
1012 Returns the type of the data property associated with the element referenced by an associative iterator references.
1018 struct value_of_data
1020 typedef __unspecified__ type;
1024 [[Parameter] [Requirement] [Description]]
1025 [[`I`] [Model of __associative_iterator__] [Operation's argument]]
1028 [heading Expression Semantics]
1029 __result_of_value_of_data__<I>::type
1031 [*Return type]: Any type
1033 [*Semantics]: Returns the type of the data property associated with the element referenced by an associative iterator `I`.
1036 #include <boost/fusion/iterator/value_of_data.hpp>
1037 #include <boost/fusion/include/value_of_data.hpp>
1040 typedef __map__<__pair__<float,int> > vec;
1041 typedef __result_of_begin__<vec>::type first;
1043 BOOST_MPL_ASSERT((boost::is_same<__result_of_value_of_data__<first>::type, int>));
1047 [section deref_data]
1049 [heading Description]
1050 Returns the type that will be returned by dereferencing the data property referenced by an associative iterator.
1058 typedef __unspecified__ type;
1062 [[Parameter] [Requirement] [Description]]
1063 [[`I`] [Model of __associative_iterator__] [Operation's argument]]
1066 [heading Expression Semantics]
1067 __result_of_deref_data__<I>::type
1069 [*Return type]: Any type
1071 [*Semantics]: Returns the result of dereferencing the data property referenced by an associative iterator of type `I`.
1074 #include <boost/fusion/iterator/deref_data.hpp>
1075 #include <boost/fusion/include/deref_data.hpp>
1078 typedef map<pair<float, int> > map_type;
1079 typedef boost::fusion::result_of::begin<map_type>::type i_type;
1080 typedef boost::fusion::result_of::deref_data<i_type>::type r_type;
1081 BOOST_STATIC_ASSERT((boost::is_same<r_type, int&>::value));