Boost logo

Boost :

From: Aleksey Gurtovoy (agurtovoy_at_[hidden])
Date: 2005-01-23 21:19:16


Alexander Nasonov writes:
> 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).

What if you define a "signature" as an (overload set, index) pair, declare
it as a standard way to pass things around (within your library, that is), and
make 'overload_set_iter' return that on dereference? Any reason why the
approach you outline below is preferable?

>
> 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,

Definitely.

> let me use more hacks legally. I'm not sure it will always be possible
> not to touch mpl code, but I'll try.

I'm willing to make the necessary changes once we explore the design space
to the extent that would make the need obvious.

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

Sure thing. Have fun,

--
Aleksey Gurtovoy
MetaCommunications Engineering

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