Boost logo

Boost Users :

Subject: [Boost-users] [mpl] for_each and set_c: misunderstanding or bug?
From: Nevin \ (nevin_at_[hidden])
Date: 2009-03-19 17:09:28


A friend of mine is having problems using setc with for_each. Given
the following code:

struct p
{
    template<typename T>
    void operator()(T) const
    { std::cout << typeid(T).name() << std::endl; }
};

typedef mpl::vector_c<int, 1, 2> vc;
typedef mpl::set< mpl::integral_c<int, 1>, mpl::integral_c<int, 2> > si;
typedef mpl::set_c<int, 1, 2> sc;

int main()
{
    mpl::for_each<vc>(p());
    mpl::for_each<si>(p());
    mpl::for_each<sc>(p()); // line does not compile
}

Under gcc 4.0.1 and Boost 1.38.0, we get the following error messages
for the line in question:

boost/mpl/next_prior.hpp:30: error: no type named 'base' in 'struct
boost::mpl::set0_c<int>'
boost/mpl/eval_if.hpp:38: error: no type named 'type' in 'struct
boost::mpl::next<boost::mpl::s_iter<sc, boost::mpl::set0_c<int> > >'
boost/mpl/for_each.hpp:78: error: 'value' is not a member of
'<declaration error>'
boost/mpl/for_each.hpp:78: error: 'execute' is not a member of
'<declaration error>'

Is this a misunderstanding on how to use for_each and set_c on our part?

Regards,

-- 
 Nevin ":-)" Liber  <mailto:nevin_at_[hidden]>  (847) 691-1404

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