|
Boost : |
From: Alexander Nasonov (alnsn_at_[hidden])
Date: 2005-01-25 05:20:49
Aleksey Gurtovoy wrote:
> Oh, I see it now: specializing 'iter_apply1' allows for intuitively
> obvious
>
> find_if< overloads, is_same<bool(int),_1> >
>
> while my suggestion would require something like
>
> find_if<
> overloads
> , overload_match< _1, is_same<bool(int),_1> >
> >
Exactly!
> That's indeed quite appealing. However, specializing 'iter_apply1' this way
> assumes that it's always invoked on a predicate metafunction, which,
> at least theoretically, does not hold.
Either predicate or metafunction that returns IntegralConstant constructed from
sizeof (possibly shifted).
> On the other hand, with 'typeof',
> dereferencing 'overload_set_iter' would simply return a corresponding
> function type and things would "just work"
That's true.
> ... without any special effort on
> our side, and in that light 'iter_apply1' specialization for the compilers
> that need it is simply an implementation detail which I'm willing to close
> my eyes to ;). It's going to be interesting to see how many MPL algorithms
> can be made to work with overload sequences using this approach.
I've already tried find find_if contains and equal.
Here is my plan. For now, we can reimplement mpl algorithms based on
predicate using iter_applyN. Later, when typeof becomes common among
popular compilers we can switch seamlessly to typeof.
-- Alexander Nasonov
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk