|
Boost Users : |
From: David Abrahams (dave_at_[hidden])
Date: 2007-06-11 00:18:56
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
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