Boost logo

Boost :

Subject: Re: [boost] [contract] concepts: pseudo-signatures vs. usage patterns
From: Dave Abrahams (dave_at_[hidden])
Date: 2012-10-12 09:46:25


on Thu Oct 11 2012, Andrew Sutton <asutton.list-AT-gmail.com> wrote:

>> For examples of forced conversions inserted to deal with this issue,
>> search for "pred" in
>> http://gcc.gnu.org/viewcvs/trunk/libstdc%2B%2B-v3/include/bits/stl_algo.h?view=markup
>
> Interesting. It's terrifying that somebody should have to do that.

What scares me is that this issue was well-known during the development
of concepts for C++0x, and yet somehow it didn't get communicated to
the people currently working on the problem.

>> Looking at N3351, I wonder if you implemented these algorithms and threw
>> strict archetypes at the implementations. It looks very much like you
>> would need similar contortions.
>
> We did (omitting a handful), with constraints mostly matching what
> appeared in n3551, but the archetype framework wasn't in place until
> some time later.
>
> If I remember correctly, we assumed that a conversion requirement on
> the result of an operation, would actually convert (if necessary).

What does "if necessary" mean? I can think of at least two different
ways to decide whether a conversion is necessary.

> You couldn't, for example, return tribool from == and expect the
> compiler to pick up overloads for &&, ||, and !.

I don't understand quite how this can be an example of the previous
statement (or what you're driving at overall).

> That would be a bad thing (unless your generic algorithm was
> parameterized over the underlying logic).
>

-- 
Dave Abrahams
BoostPro Computing                  Software Development        Training
http://www.boostpro.com             Clang/LLVM/EDG Compilers  C++  Boost

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