Boost logo

Boost Users :

Subject: Re: [Boost-users] boost::mpl::map and boost::mpl::for_each -- code does not compile -- any help appreciated
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-10-07 18:28:55


AMDG

peter_foelsche_at_[hidden] wrote:
> template<typename I2E_PAIR, typename E2I>
>
> struct CCreatePair:boost::mpl::pair<typename I2E_PAIR::first,
> boost::mpl::at<E2I, typename I2E_PAIR::second> >
>

typename boost::mpl::at<...>::type

> {
>
> };
>
>
>
>
>
> struct CDoSomething
>
> { template<unsigned int INDEX0, unsigned int INDEX1>
>

template<int INDEX0, int INDEX1>

gcc is picky about the types matching.

> inline void operator()(const
> boost::mpl::pair<boost::mpl::int_<INDEX0>, boost::mpl::int_<INDEX1> >
> &_r) const
>
> { std::cout << INDEX0 << " " << INDEX1 << "\n";
>
> }
>
> };
>
>
>
> int main(int, char**)
>
> { boost::mpl::for_each<
>
> CMapForward,
>
> template CCreatePair<boost::mpl::_1, CMapReverse>
>

boost::mpl::lambda<CCreatePair<boost::mpl::_1, CMapReverse> >::type

I'm not sure why the lambda is needed, but otherwise, the compiler tries to
instantiate CCreatePair<boost::mpl::_1, CMapReverse>

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