Boost logo

Boost :

Subject: Re: [boost] From Concept class to type traits
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2009-06-14 15:20:04


joel wrote:
> Is there any deep explanation on how the concept_check class from
> Boost:/Concept works ?
>
> I'm trying to see how to turn a concept into a traits but all my attempt
> are failing miserably and I think that's because I don't get how the
> concept check work in itself.

Concept_check simply instantiates a function named "requires" but never
calls it.
If the function body contains expressions not supported by the types
concerned then C++ will generate an error by itself.

To adapt that into a trait, you need support for SFINAE for expressions.
Such is available in both C++03 and C++0x in GCC since version 4.4, for
example.


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