Opened 14 years ago

Last modified 12 years ago

#2487 new Feature Requests

Calculate the mlp::and_ or mpl_or of a sequence of nullary logical metafunctions.

Reported by: vicente.botet@… Owned by: Aleksey Gurtovoy
Milestone: Boost 1.38.0 Component: mpl
Version: Boost 1.36.0 Severity: Cosmetic
Keywords: Cc:

Description

Do you think that these two metafunctions have a place in mpl?

template <typename Seq> struct and_seq : boost::is_same<typename mpl::find_if<Seq, mpl::not_<mpl::_> >::type,

typename mpl::end<Seq>::type>

{};

template <typename Seq> struct or_seq : mpl::not_<boost::is_same<typename mpl::find_if<Seq, mpl::_>::type,

typename mpl::end<Seq>::type>

{};

I have attached the code and the tests.

Attachments (5)

and_seq.hpp (862 bytes ) - added by vicente.botet@… 14 years ago.
mlp::and_ of a sequence of nullary logical metafunctions.
or_seq.hpp (856 bytes ) - added by vicente.botet@… 14 years ago.
mlp::or_ of a sequence of nullary logical metafunctions.
or_seq.2.hpp (856 bytes ) - added by vicente.botet@… 14 years ago.
mlp::or_ of a sequence of nullary logical metafunctions.
test_and_seq.cpp (1.3 KB ) - added by vicente.botet@… 14 years ago.
and_seq test
test_or_seq.cpp (1.4 KB ) - added by vicente.botet@… 14 years ago.
or_seq test

Download all attachments as: .zip

Change History (6)

by vicente.botet@…, 14 years ago

Attachment: and_seq.hpp added

mlp::and_ of a sequence of nullary logical metafunctions.

by vicente.botet@…, 14 years ago

Attachment: or_seq.hpp added

mlp::or_ of a sequence of nullary logical metafunctions.

by vicente.botet@…, 14 years ago

Attachment: or_seq.2.hpp added

mlp::or_ of a sequence of nullary logical metafunctions.

by vicente.botet@…, 14 years ago

Attachment: test_and_seq.cpp added

and_seq test

by vicente.botet@…, 14 years ago

Attachment: test_or_seq.cpp added

or_seq test

comment:1 by cppljevans@…, 12 years ago

The while_recur2.hpp attachment to another ticket:

https://svn.boost.org/trac/boost/attachment/ticket/3044/while_recur.2.cpp

would be one way to implement these two metafunctions, as claimed by the post:

http://lists.boost.org/Archives/boost/2009/06/153119.php

Note: See TracTickets for help on using tickets.