Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

PrevUpHomeNext

zip_view

Description

zip_view presents a view which iterates over a collection of Sequence(s) in parallel. A zip_view is constructed from a Sequence of references to the component Sequences.

Header
#include <boost/fusion/view/zip_view.hpp>
#include <boost/fusion/include/zip_view.hpp>
Synopsis
template <typename Sequences>
struct zip_view;
Template parameters

Parameter

Description

Default

Sequences

A Forward Sequence of references to other Fusion Sequences

Model of

Notation

ZV

A zip_view type

s

An instance of Sequences

zv1, zv2

Instances of ZV

Expression Semantics

Semantics of an expression is defined only where it differs from, or is not defined in Forward Sequence.

Expression

Semantics

ZV(s)

Creates a zip_view given a sequence of references to the component Sequences.

ZV(zv1)

Copy constructs a zip_view from another zip_view, zv.

zv1 = zv2

Assigns to a zip_view, zv, from another zip_view, zv2.

Example
typedef vector<int,int> vec1;
typedef vector<char,char> vec2;
vec1 v1(1,2);
vec2 v2('a','b');
typedef vector<vec1&, vec2&> sequences;
std::cout << zip_view<sequences>(sequences(v1, v2)) << std::endl; // ((1 a) (2 b))

PrevUpHomeNext