Boost logo

Boost Users :

Subject: [Boost-users] mpl::set and mpl::fold
From: Paul Graphov (graphov_at_[hidden])
Date: 2010-09-01 02:04:01


Hello Boost Users,

I've encountered a problem while using mpl::fold with mpl::set

I've defined a template to check if one sequence contains all elements of
the other:

namespace mpl = boost::mpl;
template<class A, class B>
struct subset
  : mpl::fold<
    A,
    mpl::true_,
    mpl::and_<mpl::_1, mpl::contains<B, mpl::_2> >
>
{};

It works fine with lists and vectors but when first template parameter (A)
is set or set_c
it fails to compile. Did I miss something? Why is it impossible to iterate
through a set via fold?

p.s. tested on gcc and clang under linux.
p.p.s. compilation error is quite huge, the main message is

/usr/local/include/boost/mpl/eval_if.hpp:38: error: no type named ‘type’ in
‘struct boost::mpl::next<boost::mpl::s_iter<boost::mpl::set_c<int, 1l,
9223372036854775807l, 9223372036854775807l, 9223372036854775807l,
9223372036854775807l, 9223372036854775807l, 9223372036854775807l,
9223372036854775807l, 9223372036854775807l, 9223372036854775807l,
9223372036854775807l, 9223372036854775807l, 9223372036854775807l,
9223372036854775807l, 9223372036854775807l, 9223372036854775807l,
9223372036854775807l, 9223372036854775807l, 9223372036854775807l,
9223372036854775807l>, boost::mpl::set0_c<int> > >’



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