Boost logo

Boost Users :

From: Yuval Ronen (ronen_yuval_at_[hidden])
Date: 2007-05-31 17:31:52


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;
};

template <typename First, typename Second>
struct make_ptr_pair2
{
     typedef std::pair<First *, Second *> type;
};

int main(int argc, char *argv[])
{
     namespace mpl = boost::mpl;
     typedef mpl::map< mpl::pair<int, double> > my_map;
     //typedef mpl::transform< my_map, make_ptr_pair1<mpl::_1> >::type
ptr_pair_seq1;
     //typedef mpl::transform< my_map, make_ptr_pair2<mpl::_1, mpl::_2>
>::type ptr_pair_seq2;
     return 0;
}

If I uncomment any of the two mpl::transform lines in main(), the code
doesn't compile (VC8). The point is to get a sequence of std::pairs out
of the content of the mpl::map. Is there anything I'm doing wrong? Can
mpl::transform be used for mpl::map? Maybe I can do it with fusion, but
the above code seems to be something that's supposed to be working,
isn't it?

Yuval


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