You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Today I encountered an issue where I needed to ensure that some constants are edited correctly to prevent a runtime error. While it's possible to write a StaticAssert class like this:
We have a couple of animation durations in milliseconds. We want to ensure that our max duration constant is >= all of the durations. Since there's no good way to do a compile time 'max' other than nested ternaries, we use static assert to make sure none of the constants were changed to be larger than the max duration, which would cause a runtime error.
Today I encountered an issue where I needed to ensure that some constants are edited correctly to prevent a runtime error. While it's possible to write a StaticAssert class like this:
Using it is somewhat difficult, since the analyzer complains about unused variables:
It would be a bit better if you could write a top level assert:
Which is sorta like
static_assert
in C++11.The text was updated successfully, but these errors were encountered: