Back to Arangodb

zip_view

3rdParty/boost/1.78.0/libs/mpl/doc/refmanual/zip-view.html

3.12.9.13.7 KB
Original Source

| Prev Next | Back Along | Up Home | Full TOC | Front Page / Sequences / Views / zip_view |

zip_view

Synopsis

template<
      typename[Sequences](./sequences.html)>
struct[zip\_view](./zip-view.html){
    //_unspecified_//_..._};

Description

Provides a "zipped" view onto several sequences; that is, represents several sequences as a single sequence of elements each of which, in turn, is a sequence of the corresponding Sequences' elements.

#include <[boost/mpl/zip\_view.hpp](../../../../boost/mpl/zip_view.hpp)>

Model of

Parameters

ParameterRequirementDescription
SequencesA Forward Sequence of Forward SequencesSequences to be "zipped".

Expression semantics

The semantics of an expression are defined only where they differ from, or are not defined in Forward Sequence.

In the following table, v is an instance of zip_view, seq a Forward Sequence of nForward Sequences.

ExpressionSemantics
[zip\_view](./zip-view.html)<seq>[zip\_view](./zip-view.html)<seq>::type

| A lazy Forward Sequence v such that for each i in [begin<v>::type, end<v>::type) and for each j in [begin<seq>::type, end<seq>::type) deref<i>::type is identical to transform< deref<j>::type, deref<_1> >::type. | | size<v>::type |

The size of v; size<v>::value is equal to

[deref](./deref.html)<[min\_element](./min-element.html)<[transform\_view](./transform-view.html)< seq,[size](./size.html)<[\_1](./placeholders.html)> >
    >::type >::type::value;

linear complexity; see Forward Sequence.

|

Example

Element-wise sum of three vectors.

typedef[vector\_c](./vector-c.html)<int,1,2,3,4,5> v1;
typedef[vector\_c](./vector-c.html)<int,5,4,3,2,1> v2;
typedef[vector\_c](./vector-c.html)<int,1,1,1,1,1> v3;

typedef[transform\_view](./transform-view.html)<[zip\_view](./zip-view.html)<[vector](./vector.html)<v1,v2,v3> >
    ,[unpack\_args](./unpack-args.html)<[plus](./plus.html)<[\_1](./placeholders.html),[\_2](./placeholders.html),[\_3](./placeholders.html)> >
    > sum;[BOOST\_MPL\_ASSERT](./assert.html)(([equal](./equal.html)< sum,[vector\_c](./vector-c.html)<int,7,7,7,7,7> > ));

See also

Sequences, Views, filter_view, transform_view, joint_view, single_view, iterator_range

| Prev Next | Back Along | Up Home | Full TOC |

Copyright © 2001-2009 Aleksey Gurtovoy and David Abrahams Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |