
Hi,
I've got an MPL sequence containing a (rather small) number of classes. I
want to filter this sequence so that all classes that are a base of another
class in the sequence are filtered out. I thought I'd do something like
this (in pseudo-code):
is_strict_base_of(Base, Derived) =
!is_same(Base, Derived) && is_base_of(Base, Derived)
Result =
remove_if(
Interfaces,
find_if(
Interfaces,
is_strict_base_of(outer_value, inner_value)
) != end(Interfaces)
)
where outer_value is the iteration value of the remove_if loop, and
inner_value is the iteration value of the count_if loop.
Yes, this is N², but since the length of the initial sequence is very
unlikely to exceed 8, I can live with that.
In MPL syntax:
template
::type Bases;
How do I represent outer_value and inner_value in this expression? It seems I can't simply put mpl::_1 and mpl::_2 there, since that gives me a static assertion failure (argument is not available). I think I have to put an apply somewhere in there, but I can't figure out where. Sebastian