From: Douglas Gregor (doug.gregor_at_[hidden])
Date: 2006-04-12 20:35:10
On Apr 12, 2006, at 5:36 PM, Paul Mensonides wrote:
>> -----Original Message-----
>> From: boost-bounces_at_[hidden]
>> [mailto:boost-bounces_at_[hidden]] On Behalf Of Doug Gregor
>> When we initially type-check lower_bound, we need to
>> determine if there is an advance() that we can call. Both #1
>> and #2 have been seen, so we check them. Can we call #1?
>> Sure, because every ForwardIterator is also an InputIterator.
>> Can we call #2? Nope, our ForwardIterator is not guaranteed
>> to be a BidirectionalIterator.
> What happens if you have more than one seed?
The program is ill-formed and the compiler will report an ambiguity
when type-checking the template definition.
> Is the name resolution related to the seed is implicitly added to
> the concept
> requirements that are checked immediately prior to instantiation?
> Or is the
> name resolution done during normal instantiation (with a restricted
> set of
> possible bindings)?
>> [*] Yes, instantiation can still fail if partial ordering of
>> function templates returns an ambiguity. We can synthesize it
>> all we want, but it has yet to actually bite us in practice.
> Well, it seems like an reasonable tradeoff--though I guarantee that
> the above
> will bite eventually (which is no worse than what we have now).
Everything will bite you eventually, unless you give up
specialization entirely. For more information on the issue, see:
Jaakko Järvi, Douglas Gregor, Jeremiah Willcock, Andrew Lumsdaine,
and Jeremy Siek. Algorithm specialization in generic programming:
Challenges of constrained generics in C++.
Note: Accepted for publication in PLDI, June 2006.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk