| 1 | <?xml version="1.0" encoding="utf-8" ?> | 
|---|
| 2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | 
|---|
| 3 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | 
|---|
| 4 | <!-- Copyright Aleksey Gurtovoy 2006. Distributed under the Boost --> | 
|---|
| 5 | <!-- Software License, Version 1.0. (See accompanying --> | 
|---|
| 6 | <!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) --> | 
|---|
| 7 | <head> | 
|---|
| 8 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | 
|---|
| 9 | <meta name="generator" content="Docutils 0.3.6: http://docutils.sourceforge.net/" /> | 
|---|
| 10 | <title>The MPL Reference Manual: zip_view</title> | 
|---|
| 11 | <link rel="stylesheet" href="../style.css" type="text/css" /> | 
|---|
| 12 | </head> | 
|---|
| 13 | <body class="docframe refmanual"> | 
|---|
| 14 | <table class="header"><tr class="header"><td class="header-group navigation-bar"><span class="navigation-group"><a href="./transform-view.html" class="navigation-link">Prev</a> <a href="./intrinsic-metafunctions.html" class="navigation-link">Next</a></span><span class="navigation-group-separator"> | </span><span class="navigation-group"><a href="./transform-view.html" class="navigation-link">Back</a> Along</span><span class="navigation-group-separator"> | </span><span class="navigation-group"><a href="./views.html" class="navigation-link">Up</a> <a href="../refmanual.html" class="navigation-link">Home</a></span><span class="navigation-group-separator"> | </span><span class="navigation-group"><a href="./refmanual_toc.html" class="navigation-link">Full TOC</a></span></td> | 
|---|
| 15 | <td class="header-group page-location"><a href="../refmanual.html" class="navigation-link">Front Page</a> / <a href="./sequences.html" class="navigation-link">Sequences</a> / <a href="./views.html" class="navigation-link">Views</a> / <a href="./zip-view.html" class="navigation-link">zip_view</a></td> | 
|---|
| 16 | </tr></table><div class="header-separator"></div> | 
|---|
| 17 | <div class="section" id="zip-view"> | 
|---|
| 18 | <h1><a class="toc-backref" href="./views.html#id351" name="zip-view">zip_view</a></h1> | 
|---|
| 19 | <div class="section" id="zip-synopsis"> | 
|---|
| 20 | <h3><a class="subsection-title" href="#synopsis" name="synopsis">Synopsis</a></h3> | 
|---|
| 21 | <pre class="literal-block"> | 
|---|
| 22 | template< | 
|---|
| 23 |       typename <a href="./sequences.html" class="identifier">Sequences</a> | 
|---|
| 24 |     > | 
|---|
| 25 | struct <a href="./zip-view.html" class="identifier">zip_view</a> | 
|---|
| 26 | { | 
|---|
| 27 |     // <em>unspecified</em> | 
|---|
| 28 |     // <em>...</em> | 
|---|
| 29 | }; | 
|---|
| 30 | </pre> | 
|---|
| 31 | </div> | 
|---|
| 32 | <div class="section" id="zip-description"> | 
|---|
| 33 | <h3><a class="subsection-title" href="#description" name="description">Description</a></h3> | 
|---|
| 34 | <p>Provides a "zipped" view onto several sequences; that is, represents several  | 
|---|
| 35 | sequences as a single sequence of elements each of which, in turn,  | 
|---|
| 36 | is a sequence of the corresponding <tt class="literal"><span class="pre"><a href="./sequences.html" class="identifier">Sequences</a></span></tt>' elements.</p> | 
|---|
| 37 | </div> | 
|---|
| 38 | <div class="section" id="zip-header"> | 
|---|
| 39 | <h3><a class="subsection-title" href="#header" name="header">Header</a></h3> | 
|---|
| 40 | <pre class="literal-block"> | 
|---|
| 41 | #include <<a href="../../../../boost/mpl/zip_view.hpp" class="header">boost/mpl/zip_view.hpp</a>> | 
|---|
| 42 | </pre> | 
|---|
| 43 | </div> | 
|---|
| 44 | <div class="section" id="zip-model-of"> | 
|---|
| 45 | <h3><a class="subsection-title" href="#model-of" name="model-of">Model of</a></h3> | 
|---|
| 46 | <ul class="simple"> | 
|---|
| 47 | <li><a class="reference" href="./forward-sequence.html">Forward Sequence</a></li> | 
|---|
| 48 | </ul> | 
|---|
| 49 | </div> | 
|---|
| 50 | <div class="section" id="zip-parameters"> | 
|---|
| 51 | <h3><a class="subsection-title" href="#parameters" name="parameters">Parameters</a></h3> | 
|---|
| 52 | <table border="1" class="table"> | 
|---|
| 53 | <colgroup> | 
|---|
| 54 | <col width="19%" /> | 
|---|
| 55 | <col width="43%" /> | 
|---|
| 56 | <col width="38%" /> | 
|---|
| 57 | </colgroup> | 
|---|
| 58 | <thead valign="bottom"> | 
|---|
| 59 | <tr><th>Parameter</th> | 
|---|
| 60 | <th>Requirement</th> | 
|---|
| 61 | <th>Description</th> | 
|---|
| 62 | </tr> | 
|---|
| 63 | </thead> | 
|---|
| 64 | <tbody valign="top"> | 
|---|
| 65 | <tr><td><tt class="literal"><span class="pre"><a href="./sequences.html" class="identifier">Sequences</a></span></tt></td> | 
|---|
| 66 | <td>A <a class="reference" href="./forward-sequence.html">Forward Sequence</a> of | 
|---|
| 67 | <a class="reference" href="./forward-sequence.html">Forward Sequence</a>s</td> | 
|---|
| 68 | <td>Sequences to be "zipped".</td> | 
|---|
| 69 | </tr> | 
|---|
| 70 | </tbody> | 
|---|
| 71 | </table> | 
|---|
| 72 | </div> | 
|---|
| 73 | <div class="section" id="zip-expression-semantics"> | 
|---|
| 74 | <h3><a class="subsection-title" href="#expression-semantics" name="expression-semantics">Expression semantics</a></h3> | 
|---|
| 75 | <p>The semantics of an expression are defined only | 
|---|
| 76 | where they differ from, or are not defined in <a class="reference" href="./forward-sequence.html">Forward Sequence</a>.</p> | 
|---|
| 77 | <p>In the following table, <tt class="literal"><span class="pre">v</span></tt> is an instance of <tt class="literal"><span class="pre"><a href="./zip-view.html" class="identifier">zip_view</a></span></tt>, <tt class="literal"><span class="pre">seq</span></tt> a <a class="reference" href="./forward-sequence.html">Forward Sequence</a> of <tt class="literal"><span class="pre">n</span></tt> | 
|---|
| 78 | <a class="reference" href="./forward-sequence.html">Forward Sequence</a>s.</p> | 
|---|
| 79 | <table border="1" class="table"> | 
|---|
| 80 | <colgroup> | 
|---|
| 81 | <col width="34%" /> | 
|---|
| 82 | <col width="66%" /> | 
|---|
| 83 | </colgroup> | 
|---|
| 84 | <thead valign="bottom"> | 
|---|
| 85 | <tr><th>Expression</th> | 
|---|
| 86 | <th>Semantics</th> | 
|---|
| 87 | </tr> | 
|---|
| 88 | </thead> | 
|---|
| 89 | <tbody valign="top"> | 
|---|
| 90 | <tr><td><pre class="first last literal-block"> | 
|---|
| 91 | <a href="./zip-view.html" class="identifier">zip_view</a><seq> | 
|---|
| 92 | <a href="./zip-view.html" class="identifier">zip_view</a><seq>::type | 
|---|
| 93 | </pre> | 
|---|
| 94 | </td> | 
|---|
| 95 | <td>A lazy <a class="reference" href="./forward-sequence.html">Forward Sequence</a> <tt class="literal"><span class="pre">v</span></tt> such that for each <tt class="literal"><span class="pre">i</span></tt> | 
|---|
| 96 | in [<tt class="literal"><span class="pre"><a href="./begin.html" class="identifier">begin</a><v>::type</span></tt>, <tt class="literal"><span class="pre"><a href="./end.html" class="identifier">end</a><v>::type</span></tt>) and for each <tt class="literal"><span class="pre">j</span></tt> in | 
|---|
| 97 | [<tt class="literal"><span class="pre"><a href="./begin.html" class="identifier">begin</a><seq>::type</span></tt>, <tt class="literal"><span class="pre"><a href="./end.html" class="identifier">end</a><seq>::type</span></tt>) | 
|---|
| 98 | <tt class="literal"><span class="pre"><a href="./deref.html" class="identifier">deref</a><i>::type</span></tt> is identical to | 
|---|
| 99 | <tt class="literal"><span class="pre"><a href="./transform.html" class="identifier">transform</a><</span> <span class="pre"><a href="./deref.html" class="identifier">deref</a><j>::type,</span> <span class="pre"><a href="./deref.html" class="identifier">deref</a><_1></span> <span class="pre">>::type</span></tt>.</td> | 
|---|
| 100 | </tr> | 
|---|
| 101 | <tr><td><tt class="literal"><span class="pre"><a href="./size.html" class="identifier">size</a><v>::type</span></tt></td> | 
|---|
| 102 | <td><p class="first">The size of <tt class="literal"><span class="pre">v</span></tt>; <tt class="literal"><span class="pre"><a href="./size.html" class="identifier">size</a><v>::value</span></tt> is equal to</p> | 
|---|
| 103 | <pre class="literal-block"> | 
|---|
| 104 | <a href="./deref.html" class="identifier">deref</a>< <a href="./min-element.html" class="identifier">min_element</a>< | 
|---|
| 105 |       <a href="./transform-view.html" class="identifier">transform_view</a>< seq, <a href="./size.html" class="identifier">size</a><_1> > | 
|---|
| 106 |     >::type >::type::value; | 
|---|
| 107 | </pre> | 
|---|
| 108 | <p class="last">linear complexity; see <a class="reference" href="./forward-sequence.html">Forward Sequence</a>.</p> | 
|---|
| 109 | </td> | 
|---|
| 110 | </tr> | 
|---|
| 111 | </tbody> | 
|---|
| 112 | </table> | 
|---|
| 113 | </div> | 
|---|
| 114 | <div class="section" id="zip-example"> | 
|---|
| 115 | <h3><a class="subsection-title" href="#example" name="example">Example</a></h3> | 
|---|
| 116 | <p>Element-wise sum of three vectors.</p> | 
|---|
| 117 | <pre class="literal-block"> | 
|---|
| 118 | typedef <a href="./vector-c.html" class="identifier">vector_c</a><int,1,2,3,4,5> v1; | 
|---|
| 119 | typedef <a href="./vector-c.html" class="identifier">vector_c</a><int,5,4,3,2,1> v2; | 
|---|
| 120 | typedef <a href="./vector-c.html" class="identifier">vector_c</a><int,1,1,1,1,1> v3; | 
|---|
| 121 |  | 
|---|
| 122 | typedef <a href="./transform-view.html" class="identifier">transform_view</a>< | 
|---|
| 123 |       <a href="./zip-view.html" class="identifier">zip_view</a>< <a href="./vector.html" class="identifier">vector</a><v1,v2,v3> > | 
|---|
| 124 |     , <a href="./unpack-args.html" class="identifier">unpack_args</a>< <a href="./plus.html" class="identifier">plus</a><_1,_2,_3> > | 
|---|
| 125 |     > sum; | 
|---|
| 126 |  | 
|---|
| 127 | <a href="./assert.html" class="identifier">BOOST_MPL_ASSERT</a>(( <a href="./equal.html" class="identifier">equal</a>< sum, <a href="./vector-c.html" class="identifier">vector_c</a><int,7,7,7,7,7> > )); | 
|---|
| 128 | </pre> | 
|---|
| 129 | </div> | 
|---|
| 130 | <div class="section" id="zip-see-also"> | 
|---|
| 131 | <h3><a class="subsection-title" href="#see-also" name="see-also">See also</a></h3> | 
|---|
| 132 | <p><a class="reference" href="./sequences.html">Sequences</a>, <a class="reference" href="./views.html">Views</a>, <a class="refentry reference" href="./filter-view.html"><tt class="refentry literal"><span class="pre">filter_view</span></tt></a>, <a class="refentry reference" href="./transform-view.html"><tt class="refentry literal"><span class="pre">transform_view</span></tt></a>, <a class="refentry reference" href="./joint-view.html"><tt class="refentry literal"><span class="pre">joint_view</span></tt></a>, <a class="refentry reference" href="./single-view.html"><tt class="refentry literal"><span class="pre">single_view</span></tt></a>, <a class="refentry reference" href="./iterator-range.html"><tt class="refentry literal"><span class="pre">iterator_range</span></tt></a></p> | 
|---|
| 133 | <!-- modtime: November 13, 2004 01:15:49 +0000 --> | 
|---|
| 134 | </div> | 
|---|
| 135 | </div> | 
|---|
| 136 |  | 
|---|
| 137 | <div class="footer-separator"></div> | 
|---|
| 138 | <table class="footer"><tr class="footer"><td class="header-group navigation-bar"><span class="navigation-group"><a href="./transform-view.html" class="navigation-link">Prev</a> <a href="./intrinsic-metafunctions.html" class="navigation-link">Next</a></span><span class="navigation-group-separator"> | </span><span class="navigation-group"><a href="./transform-view.html" class="navigation-link">Back</a> Along</span><span class="navigation-group-separator"> | </span><span class="navigation-group"><a href="./views.html" class="navigation-link">Up</a> <a href="../refmanual.html" class="navigation-link">Home</a></span><span class="navigation-group-separator"> | </span><span class="navigation-group"><a href="./refmanual_toc.html" class="navigation-link">Full TOC</a></span></td> | 
|---|
| 139 | </tr></table></body> | 
|---|
| 140 | </html> | 
|---|