Boost logo

Boost Users :

From: Andrej van der Zee (mavdzee_at_[hidden])
Date: 2007-06-10 13:03:21


Hi,

Sorry if this already has been posted, but I have a
problem with compile-time performance when trying to
get the intersection of two type sequences. For
example, when I do something like this:

template<typename list1, typename list2>
struct intersect
{
  typedef typename boost::mpl::remove_if<list1,
    mpl::not_< mpl::contains<list2, mpl::_1>
>::type type;
};

typedef mpl::vector<a,b,...,z> l1;
typedef mpl::vector<c,e,t,u,v> l2;

typename intersect<list1,list2>::type my_intersection;

Then for large type sequences compile-time becomes
unacceptable (O(M*N)).

Is there a better way to do this?

Thanks,
Andrej
 

                
___________________________________________________________
To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre. http://uk.security.yahoo.com


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net