Boost logo

Boost :

Subject: Re: [boost] [contract] first attempt to N3351 concepts
From: Lorenzo Caminiti (lorcaminiti_at_[hidden])
Date: 2012-10-10 13:02:08

On Wed, Oct 10, 2012 at 1:51 AM, Andrzej Krzemienski <akrzemi1_at_[hidden]> wrote:
>> > Since you asked what I think,
>> >
>> > "pseudo-signatures > usage patterns"
>> >
>> > but that's probably not the kind of information you were looking for :-)
>> Yes, that's more of a critique to N3351 than my design to implement it
>> but it's a fare comment. If N3351 approach is to be abandoned in favor
>> of pseudo-signatures then no point in implementing N3351 but I don't
>> think there's consensus on this either way yet. I personally don't
>> have an opinion yet... (and maybe I should have an opinion before I go
>> off an impl the entire N3351).
> Even if you decide to go with pseudo-signatures, one novel thing from N3351
> is worth adapting: treating every concept as a predicate, so that the
> programmer can check himself whether a certain set of types models the
> concept:
> static_assert( ForwardIterator<int*>, "ouch" );
> and so that you can combine concept requirements with any boolean
> meta-function:
> template <class T> requires Copyable<T> && sizeof(T) < 8 ...

I agree that concepts should be boolean meta-functions as they are in
N3351, they will be in Boost.Contract, and I think they are in
Boost.Generic. Also I think that's the only (?) way for concepts to
remove the function/class templates from the overload/specialization
set instead of causing a hard compiler error.

However, there might be some requirements that cannot be checked as a
boolean meta-function but that can be checked as to generate an hard
compiler error. For example, in C++03 we could not program an
has_copy_constructor boolean meta-function but Boost.ConceptCheck can
check the CopyConstructible concept to generate a hard compiler error.
If there are similar situations in C++11 still, that's a reason to
keep Boost.ConceptCheck around in C++11 together with Boost.Contract
and Boost.Generic concepts.


Boost list run by bdawes at, gregod at, cpdaniel at, john at