Boost logo

Boost :

From: Andrei Alexandrescu (andrewalex_at_[hidden])
Date: 2002-04-14 20:55:18

"Aleksey Gurtovoy" <agurtovoy_at_[hidden]> wrote in message
> How about this one:
> template <class L, class R>
> struct InheritTwo : public L, public R
> {
> };
> template< typename Sequence, typename F >
> struct GenScatterHierarchy
> : mpl::fold< Sequence, mpl::none, InheritTwo< mpl::apply<F,_1>,
_2 >
> {
> };

The versions of GenScatterHierarchy and count_if that you posted
lately look better indeed. They do rely on quite some mpl artifacts -
much more than I find palatable for what they do -, but I guess
there's no reason to agonize over that.

> > This being said, an implementation of GenScatterHierarchy that
> > only for dot-typelists and relies on nothing but C++ itself, has
> > lines, defines 1 new type, and doesn't use but the typelist
> FWIW, the MPL's version above is 9 lines long. Much more
importantly, it's
> something that is explainable to a non-expert in 5 minutes. (IMO
> version is not).

(In the meantime I realized I could have reduced the length of
GenScatterHierarchy by eliminating the unnecessary LeftBase and
RightBase convenience typedefs. But oh well.)

I believe we reduced irreductible viewpoints about the ease of
explanation of the two idioms, so I won't insist on it anymore. The
truth is simple: we are both right. At least because for people like
you, one version is more appealing, and for people like me, the other


Boost list run by bdawes at, gregod at, cpdaniel at, john at