|
Boost Users : |
Subject: [Boost-users] [Concept] Understanding Boost Concept library
From: Robert Jones (robertgbjones_at_[hidden])
Date: 2019-02-28 11:49:44
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 list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net