The point of this code is to help the compiler produce “visible” error messages.
In pre static_assert
era, compiling a template-heavy code could easily produce ~100 lines of error messages even for a single mistake, and 99% of those lines are often meaningless.
The 10 pointers trick is useful to point out the actual error, for example:
BOOST_STATIC_ASSERT((std::is_same<T,U>));
With T=void*
and U=char*
compiled with gcc produces ~10 error lines, but you can easily see the relevant one:
error: no matching function for call to ‘assertion_failed(mpl_::failed************ std::is_same<void*, char*>::************)’