
On 2012-08-30 15:10, Rindeberg Magnus wrote:
#include
#include #include #include #include #include #include struct dostuff { template<typename T> void operator()(T const & x) const { // Do stuff here! } };
template<class D> struct A { };
template
struct B { typedef T type; }; struct derived_from_A : public A
{ }; struct derived_from_B : public B
{ }; typedef ::boost::mpl::vector
::type typelist_type; ::boost::fusion::result_of::as_set
::type typeset_; int main(int argc, char ** argv) { dostuff ds;
// This seems to be working! ::boost::fusion::for_each( ::boost::fusion::filter_if < ::boost::is_base_of, ::boost::mpl::_> > (typeset_), ds);
#if(0) // Don't know how to do this! Preferably I'd like to check for inheritance from B. // If that isn't possible I'll settle for "not inheriting from A". ::boost::fusion::for_each( ::boost::fusion::filter_if < ::boost::is_base_of, ::boost::mpl::_> > (typeset_), ds); #endif } The "not" part is straight forward:
::boost::fusion::for_each( ::boost::fusion::filter_if < ::boost::mpl::not_< ::boost::is_base_of, ::boost::mpl::_> > > (typeset_), ds); I can't seem to wrap my head around an is_derived_from_b template, though. But I wonder: Why do you want to add another parameter T here? Can't you just define T inside derived_from_B? Regards, Roland