[Concept] Understanding Boost Concept library

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[Concept] Understanding Boost Concept library

Boost - Users mailing list
This is a small excerpt from the Boost Concepts library, there's various
rather unusual techniques employed in it, with preprocessor tricks and
various compiler specific tweeks, but this one has defeated me!

What is the purpose of "*********** Model:: ***********" ?

Maybe it's just to generate a distinctive diagnostic, but it's very
sensitive to exact numbers of asterisks!

In general what's going on here is the compiler is checking that the
destructor of the Model (which is a concept instantiated with a particular
type), can be instantiated, but without ever running the destructor
or creating an instance of the Model.

struct failed {};

template <class Model>
struct requirement<failed ************ Model::************>
{
    static void failed() { ((Model*)0)->~Model(); }
};

Any insight appreciated.

Kind Regards

Rob.


_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users