
on Sun Jun 10 2007, Andrej van der Zee <mavdzee-AT-yahoo.co.uk> wrote:
Hi,
Than you for the quick reply :) Now I reimplemented intersect by converting the type sequences to mpl::set and do a mpl::has_key instead of mpl::contains:
template <typename seq1, typename seq2> struct intersect { typedef typename copy<seq2 , inserter< set<>, insert< _1, _2 > > >::type set_seq2;
typedef typename copy_if<seq1 , has_key <set_seq2, _1> , back_inserter < vector<> > >::type type; };
Now I would like to optimize this and only convert to a set if the type sequence does not support mpl::has_key. How should I do this?
I don't know, frankly.
I looked at the mpl::sequence_tag<seq2> but I am not sure how to use this. Nor if this is the right way to do this. Could you please help?
Maybe Aleksey can help. Sorry I couldn't. -- Dave Abrahams Boost Consulting http://www.boost-consulting.com