6 ms·
Even if not mandated by the standard, concrete standard library implementations do provide bound checking on span (and vector, and optional, etc.), but, even wh
by gpderetta 3y ago
Even if not mandated by the standard, concrete standard library implementations do provide bound checking on span (and vector, and optional, etc.), but, even when meant for production use, are disabled by default.
And I don't see a big push in the community to enable them. I think the committee is just an expression of the community on this front.
- account42 3y ago> Even if not mandated by the standard, concrete standard library implementations do provide bound checking on span (and vector, and optional, etc.), but, even when meant for production use, are disabled by default. That's a choice though. You can enable these in your production builds if you want (with libstdc++ at least) and some Linux distributions have chosen to do just that. The thing though is that these checks are NOT free and the overhead is not justified for all use cases so forcing them on everyone is not appropriate for C++.
- gpderetta 3y ago> The thing though is that these checks are NOT free and the overhead is not justified for all use cases so forcing them on everyone is not appropriate for C++. Well, that's why they should be a flag. The question is whether it should be enabled by default or not.
- fanf2 3y agoIt should be enabled by default, and if you want to index without bounds checking you should have to write something like a.unsafe_at(i)