Boost logo

Boost :

From: Steven Watanabe (steven_at_[hidden])
Date: 2007-08-13 15:59:15


AMDG

Martin Apel <martin.apel <at> simpack.de> writes:

>
> Hi all,
>
> I have two mpl maps like this:
>
> typedef
> map<pair<int_<1>, int_<42> >,
> pair<int_<2>, int_<43> >,
> pair<int_<3>, int_<44> >
> > Map1;
>
> typedef
> map<pair<int_<4>, int_<44> >,
> pair<int_<5>, int_<45> >,
> pair<int_<6>, int_<46> >
> > Map2;
>
> I try to join them using "joint_view" as follows:
>
> typedef joint_view<Map1, Map2>::type JointMap;
>
> which works fine. Then I do
>
> std::cout << at<JointMap, int_<2> >::type::value << "\n";
>
> which gives the following compiler error:
>
> error: 'value' is not a member of 'boost::mpl::pair<mpl_::int_<3>,
> mpl_::int_<44> >'
>
> I tried this with gcc 3.4.6 and 4.2 under Linux, Boost version is 1.34.0.
> It seems "at" returns the entry after the searched entry, and not only
> the right half, but the complete pair.
>
> Has anybody got any hints on this? To me it looks like a bug in MPL, but
> I might be wrong.
>

joint_veiw is not intended to work that way for
maps. It just takes the two sequences and sticks
them together. The default implementation of at
which is used for joint_view returns the Nth element
of the sequence. Since you had the keys in order
starting at 1 it appeared that it was adding one.
The value of the key is irrelevant in determining
the result.

In Christ,
Steven Watanabe


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk