Can BOOST_STATIC_ASSERT specify its own compilation error string?

Is it possible to get BOOST_STATIC_ASSERT to get compile error message? I believe this is an attempt to do this in the codebase I work in.

BOOST_STATIC_ASSERT( (MAX_NUMBER_OF_USERS == 15) && ("MAX_NUMBER_OF_USERS is no longer set to 15") );

      

Personally, I'm not sure if the error message is giving anything - I'd rather post it as a comment next to the statement.

+2


source to share


1 answer


For a static assertion, I would recommend:

BOOST_MPL_ASSERT_MSG



You pass in a C ++ id like "message" and it will appear in the error stream.

+2


source







All Articles