Boost logo

Boost :

Subject: Re: [boost] [contract] concept error messages
From: Matt Calabrese (rivorus_at_[hidden])
Date: 2012-10-07 16:28:09


On Sun, Oct 7, 2012 at 4:12 PM, Matt Calabrese <rivorus_at_[hidden]> wrote:

> On Sun, Oct 7, 2012 at 3:58 PM, Lorenzo Caminiti <lorcaminiti_at_[hidden]>wrote:
>
>> BTW, is this true also for N3351 concepts or just for C++0x concepts?
>> Because iterator tags are still in N3351 and they are even made part
>> of the specification (so they're not just an implementation
>> detail/workaround):
>>
>
> N3351 does this because they do not have direct support for explicit
> concept maps. The problem is, you still need to at least emulate explicit
> concept maps in their approach, otherwise you can get ambiguity between
> concepts that have similar requirements but with different semantics/axioms
> (such as forward iterator and input iterator). The way N3351 disambiguates
> is they require C++98 style iterator categories -- if a creator of an
> iterator type associates with it an input_iterator_tag, then it is an input
> iterator. C++0x's approach removed the need for iterator categories because
> it directly supports both auto and explicit concepts.
>

To be clear, I believe N3351 purports to support concept-based overloading
in the same way C++0x's concepts would have, but because N3351 only has
implicit refinement, how matching is done is a little bit less apparent.
Actually, the more I think about it, I can't imagine that concept-based
overloading would work properly in N3351 when you use their emulated
explicit concept maps. The problem is, if you have two concepts with the
same requirements other than something like Derived on an associated type,
and you had two overloads (one for each of the aforementioned concepts),
calls to the overloads would be ambiguous even with requires in the case
where you are dealing with an iterator_category style hierarchy for the
associated type. This should be true unless N3351-style concepts either
decide to support explicit concept maps instead of the Derived/iterator
category hack, or alternatively, if the Derived concept is altered to have
special meaning when doing matching.

-- 
-Matt Calabrese

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