I would like to start using
static_assert in the codebase that I work on. Unfortunately, not all C++ compilers support them. In the past, we’ve used a compile-time assert macro that works reasonably (gleaned from SO!), but, it gives slightly awkward compile error messages.
We support a large number of compilers, including ones which do not have support for it. Also, because our product is an SDK with source code our customers can recompile it with any compiler that they wish. So, while I could introduce conditional compilation for it in all the compilers we use, it’s not really possible for me to do it for any ‘unknown’ compiler.
Is there some compile-time predefined macro or other facility that is standard across all C++ compilers for determining the availability of
static_assert, or, are you just required to ‘know’ what every compiler supports?