mercredi 25 octobre 2017

How is is_standard_layout implemented?

In general one can implement typical type_traits using template techniques.

However I didn't imagine how std::is_standard_layout could be implemented in these terms. http://ift.tt/1eM4dye

When I checked the gcc standard library, I found that it is implemented in terms of __is_standard_layout(T) which I could not find defined anywhere else. Is this a compiler magic function?

Would it be possible to implement std::is_standard_layout explicitly?

For example one of the conditions is that it inherits from a single class. That seems to be impossible to determine at compile time.

Aucun commentaire:

Enregistrer un commentaire