Reputation: 6639
Is it possilbe to get BOOST_STATIC_ASSERT to give a custom compilation error message? I belive the following is an attempt to do that in the code base I'm working in.
BOOST_STATIC_ASSERT( (MAX_NUMBER_OF_USERS == 15) && ("MAX_NUMBER_OF_USERS is no longer set to 15") );
Personally I'm not sure the error message gives anything - I'd rather have it placed as a comment next to the assert.
Upvotes: 2
Views: 606
Reputation: 300079
For static assertion, I would recommend:
You pass a C++ identifier like 'message' and it will appear in the error stream.
Upvotes: 2