Boost logo

Boost :

From: Alexander Nasonov (alnsn_at_[hidden])
Date: 2005-01-20 17:21:19


Alexander Nasonov wrote:
> Aleksey Gurtovoy wrote:
> > Can't it be something like
> >
> > mpl::find_if<
> > overload_set<1,5,has_intersection>
> > , is_same<first_arg<_>, Circle&>
> > >
> >
> > ?
>
> Well, I could use mpl find_if but it's not the best way (unless
> mpl::find_if is specialized).

Good news, I can use mpl:find_if even though typeof isn't available!

This is how I do it:

  1. define overload_set_iter class template that takes an overload set
     and an iterator for current position.
     (If it was ever possible, deref could return a signature of an overload
     the iterator refers to).

  2. specialize mpl::aux::iter_apply1 for overload_set_iter. Unlike primary
     template, specialized version doesn't deref overload_set_iter, it
     dereferences nested position iterator and then pass that position
     to test1 metafunction. This metafunction tests a predicate passed
     to iter_apply1 indirectly (that is, by position).

This only one local hack I'm able to use mpl::find_if. This is much
better then before.

Aleksey, if you're interested in tighter integration between mpl and overloads,
let me use more hacks legally. I'm not sure it will always be possible
not to touch mpl code, but I'll try.

PS. I'll check my e-mail tomorrow morning and then I'll check it again
only on Tuesday because I'm on vacation.

-- 
Alexander Nasonov

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk