|
Boost Users : |
Subject: Re: [Boost-users] [fusion] incremental zipping
From: Christopher Schmidt (mr.chr.schmidt_at_[hidden])
Date: 2011-11-19 05:22:16
Gennadiy Rozental <rogeeff_at_[hidden]> writes:
> Hi,
>
> I am zipping fusion sequences in a series of incremental zip operations:
>
> zip(zip(zip(a,b),c),...)
>
> as a result I am getting sequence with elements like:
>
> vector2<vector2<vector2<a[i],b[i]>,c[i]>,...>
>
> what I want instead is that elements would look like:
>
> vector<a[i],b[i],c[i],...>
>
> What the simplest way to achieve this?
--8<---------------cut here---------------start------------->8---
#include <boost/fusion/algorithm/transformation/push_back.hpp>
#include <boost/fusion/container/vector.hpp>
#include <boost/fusion/container/generation.hpp>
#include <boost/fusion/sequence/io.hpp>
#include <boost/fusion/view/zip_view.hpp>
#include <iostream>
int main()
{
using namespace boost::fusion;
vector<int,int> a(0,1),b(1,2),c(2,3);
auto v=push_back(
push_back(
push_back(
make_vector(),boost::ref(a)),boost::ref(b)),boost::ref(c));
auto z=zip_view<decltype(v)>(v);
std::cout << z << std::endl;
}
--8<---------------cut here---------------end--------------->8---
Christopher
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net