mercredi 25 novembre 2015

C++ : output dynamic information to the log at compile-time

Is it possible to output dynamic information to the compiler output during compilation?

A more concrete example (C++11):

static_assert(sizeof(A) == 4, "Wrong size of A");

I would like to output the value of sizeof(A) when the assertion fails (or even always), but the message in static_assert can't contain any dynamic information.

Is there any way to output the value of sizeof(A) to the compiler log?

Aucun commentaire:

Enregistrer un commentaire