Boost logo

Boost :

Subject: Re: [boost] [contract] static_assert in contracts or not?
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2012-09-17 02:56:34

Le 17/09/12 05:26, Lorenzo Caminiti a écrit :
> On Sun, Sep 16, 2012 at 6:31 PM, Dave Abrahams <dave_at_[hidden]> wrote:
>> on Mon Sep 03 2012, Andrzej Krzemienski <> wrote:
>>> I do not know if Boost.ConceptCheck offers the capability of verifying any
>>> boolean predicate.
>> Sure; even if the concept isn't already in the library, you can easily
>> write it.
> So if we can program a static boolean predicate then we can program a
> ConceptCheck concept that will statically assert it and make it fail
> at compile-time. I guess however that the opposite is not true. There
> are conditions that can be programmed to generate a hard compiler
> failure (e.g., using ConceptCheck) but we cannot create a boolean
> meta-function for them (e.g., to use enable-if and/or SFINAE-like
> concepts).
> For example we can program CopyConstructible but we cannot program
> has_copy_constructor--am I correct? Is that true with C++11 expression
> SFINAE as well?
This depends on the c++ version as some traits need compiler help. In
C++11 there are some traits as has_copy_constructor,
has_trivial_copy_constructtor, ...
> If that is the case, there can be type requirements that we can only
> program using hard-failing-concepts (ConceptCheck concepts within
> Contract's check clause) but not using SFINAE-concepts (possible
> future Boost.Contract's requires clause).
You are surely right, but it is less evident for c++11. Do you have an


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