1.. Sequences/Views//zip_view 2 3zip_view 4======== 5 6Synopsis 7-------- 8 9.. parsed-literal:: 10 11 template< 12 typename Sequences 13 > 14 struct zip_view 15 { 16 // |unspecified| 17 // |...| 18 }; 19 20 21 22Description 23----------- 24 25Provides a "zipped" view onto several sequences; that is, represents several 26sequences as a single sequence of elements each of which, in turn, 27is a sequence of the corresponding ``Sequences``\ ' elements. 28 29 30Header 31------ 32 33.. parsed-literal:: 34 35 #include <boost/mpl/zip_view.hpp> 36 37 38 39Model of 40-------- 41 42* |Forward Sequence| 43 44 45Parameters 46---------- 47 48+---------------+-----------------------------------+-------------------------------+ 49| Parameter | Requirement | Description | 50+===============+===================================+===============================+ 51| ``Sequences`` | A |Forward Sequence| of | Sequences to be "zipped". | 52| | |Forward Sequence|\ s | | 53+---------------+-----------------------------------+-------------------------------+ 54 55Expression semantics 56-------------------- 57 58|Semantics disclaimer...| |Forward Sequence|. 59 60In the following table, ``v`` is an instance of ``zip_view``, ``seq`` a |Forward Sequence| of ``n`` 61|Forward Sequence|\ s. 62 63+-------------------------------+-----------------------------------------------------------+ 64| Expression | Semantics | 65+===============================+===========================================================+ 66| .. parsed-literal:: | A lazy |Forward Sequence| ``v`` such that for each ``i`` | 67| | in |begin/end<v>| and for each ``j`` in | 68| zip_view<seq> | [``begin<seq>::type``, ``end<seq>::type``) | 69| zip_view<seq>::type | ``deref<i>::type`` is identical to | 70| | ``transform< deref<j>::type, deref<_1> >::type``. | 71+-------------------------------+-----------------------------------------------------------+ 72| ``size<v>::type`` | The size of ``v``; ``size<v>::value`` is equal to | 73| | :: | 74| | | 75| | deref< min_element< | 76| | transform_view< seq, size<_1> > | 77| | >::type >::type::value; | 78| | | 79| | linear complexity; see |Forward Sequence|. | 80+-------------------------------+-----------------------------------------------------------+ 81 82 83Example 84------- 85 86Element-wise sum of three vectors. 87 88.. parsed-literal:: 89 90 typedef vector_c<int,1,2,3,4,5> v1; 91 typedef vector_c<int,5,4,3,2,1> v2; 92 typedef vector_c<int,1,1,1,1,1> v3; 93 94 typedef transform_view< 95 zip_view< vector<v1,v2,v3> > 96 , unpack_args< plus<_1,_2,_3> > 97 > sum; 98 99 BOOST_MPL_ASSERT(( equal< sum, vector_c<int,7,7,7,7,7> > )); 100 101 102See also 103-------- 104 105|Sequences|, |Views|, |filter_view|, |transform_view|, |joint_view|, |single_view|, |iterator_range| 106 107 108.. copyright:: Copyright � 2001-2009 Aleksey Gurtovoy and David Abrahams 109 Distributed under the Boost Software License, Version 1.0. (See accompanying 110 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 111