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

This is the documentation for an old version of boost. Click here for the latest Boost documentation.

[Home]zip_view

Synopsis

template<
      typename Sequences
    >
struct zip_view
{
    // unspecified
};

Description

zip_view provides a "zipped" view onto several sequences; that is, it allows to represent several sequences as a single sequence of elements each of those, in its turn, is a sequence of the corresponding Sequences elements.

Definition

#include "boost/mpl/zip_view.hpp"

Parameters

 Parameter  Requirement  Description  
SequencesA Sequence of SequencesSequences to be "zipped".

Expression semantics

 Expression  Expression type  Precondition  Semantics  Postcondition 
typedef zip_view<Sequences> s;A model of Sequences is a sequence such that for each i in [begin<s>::type, end<s>::type) and for each j in [begin<Sequences>::type, end<Sequences>::type) i::type is identical to transform<j::type, deref<_1> >::type .

Complexity

Amortized constant time.

Example

typedef range_c<int,0,10> s1;
typedef range_c<int,10,20> s2;

typedef transform_view< zip_view< list<s1,s2> > , apply_seq< plus<_1,_2> > > result;

BOOST_STATIC_ASSERT((equal< result , filter_view< range_c<int,10,30>, math::is_even<_1> > , equal_to<_1,_2> >::type::value));

See also

Sequences, transform_view, filter_view, joint_view, equal


Table of Contents
Last edited March 10, 2003 5:04 am