Boost logo

Boost Users :

From: Yuval Ronen (ronen_yuval_at_[hidden])
Date: 2007-06-06 03:54:49


Yuval Ronen wrote:
> Aleksey Gurtovoy wrote:
>> Yuval Ronen writes:
>>> I have the following code:
>>>
>>> #include <utility>
>>> #include <boost/mpl/map.hpp>
>>> #include <boost/mpl/transform.hpp>
>>>
>>> template <typename MplPair>
>>> struct make_ptr_pair1
>>> {
>>> typedef std::pair<typename MplPair::first *, typename MplPair::second *> type;
>> ^^^
>> mpl
>>
>
> I'm really puzzled about this. Why can't I have std::pair here? The
> whole purpose of the transform operation is to create a type-sequence of
> std::pairs. This sequence can be used, for example, with
> make_variant_over to create a variant of std::pairs. Can't I do that?

Ah, I think I got it. When the input to mpl::transform is a mpl::map,
then it tries to generate a mpl::map as output, and therefore the need
for mpl::pair. However, I don't need mpl::map as output, any Forward
Sequence will suffice (as this is what make_variant_over requires). So
is mpl::fold the answer here?


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