
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> > >’

AMDG Paul Graphov wrote:
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?
It looks like fold is trying to increment past the end of the sequence. It works for me with the trunk with set, but not with set_c. I think the problem is that end<> is broken for set_c. In Christ, Steven Watanabe

AMDG Paul Graphov wrote:
I've encountered a problem while using mpl::fold with mpl::set
Fixed in the trunk in http://svn.boost.org/trac/boost/changeset/65166 In Christ, Steven Watanabe

Thank you! On 1 September 2010 19:18, Steven Watanabe <watanabesj@gmail.com> wrote:
AMDG
Paul Graphov wrote:
I've encountered a problem while using mpl::fold with mpl::set
Fixed in the trunk in http://svn.boost.org/trac/boost/changeset/65166
In Christ, Steven Watanabe
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Paul Graphov
-
Steven Watanabe