3 ms·
And with the "usual" access '[]' std::vector doesn't bound check either, you have to use 'at' for this (except in some library with some flags ), doesn't seem t
by renox 8y ago
And with the "usual" access '[]' std::vector doesn't bound check either, you have to use 'at' for this (except in some library with some flags ), doesn't seem that safe to me!
- MaxBarraclough 8y agoAgree. It strikes me as silly that C++ doesn't provide something like a `CHECKED` macro, so that operator[] could always be range-checked in debug/dev builds, but not in release builds. The two-different-methods approach seems awfully clunky - what ends up happening is that no-one uses the `at` method. I see no good reason not to enable range-checks by default in debug builds. This 'unsafe by default' philosophy isn't universal in C++ though. The smart-pointer class-templates are always thread-safe, despite the possible performance consequences.