Implement bounds checking for the various layouts, so we can actually detect the issue
I aimed for C++14 backwards compatibility. Item (2) above is not strictly necessary to fix the issue, but it does help with finding the issue in the first place.
Bounds checking is only enabled in a debug build (if NDEBUG is not defined). It involves some fold expressions over assert expressions. I'm not attached to the use of assert for reporting errors.
Link to issue: https://cplusplus.github.io/LWG/issue4060
I aimed for C++14 backwards compatibility. Item (2) above is not strictly necessary to fix the issue, but it does help with finding the issue in the first place.
Bounds checking is only enabled in a debug build (if
NDEBUG
is not defined). It involves some fold expressions overassert
expressions. I'm not attached to the use ofassert
for reporting errors.