Boost logo

Boost Users :

Subject: Re: [Boost-users] [MPL] Fold a vector of pairs
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2012-03-14 11:31:23


AMDG

On 03/14/2012 01:25 AM, Peter Nyssen wrote:
>
> <snip>
> typedef typename mpl::fold<
> initial_vector,
> mpl::pair<mpl::vector<>, mpl::vector<> >,
> mpl::if_<
> is_tag1<mpl::first<mpl::_2> >,
> mpl::push_back<
> mpl::first<mpl::_1>,
> mpl::second<mpl::_2>
> >,
> mpl::push_back<
> mpl::second<mpl::_1>,
> mpl::second<mpl::_2>
> >
> >
> >::type sorted_pair;
>
> <snip>
>
> //-------------------------------------
>
> $ g++4 -Wall -I ../boost/ -o test test.cpp
> test.cpp: In function 'int main()':
> test.cpp:28: error: using 'typename' outside of template

This should be obvious.

> ../boost/boost/mpl/pair.hpp:56: error: no type named 'second' in 'struct
> boost::mpl::v_item<mpl_::int_<1>, boost::mpl::vector<mpl_::na, mpl_::na,
> <snip>,

The state should be a pair of vectors, but the
fold operation produces a single vector.

In Christ,
Steven Watanabe


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