I have several classes with “static const” data members.
I would like to know how to check their values at compile time with static_assert.
Can I put static_assert directly in the class body ?
(Putting my static_assert in every constructor is not very practical.)
I have several classes with static const data members. I would like to know
Share
Yes,
static_assert()can be placed everywhere a declaration can, too. That includes the body of a class: