4 ms·
Sometimes there are ways of getting runtime bounds checking. For example, both of these return the 3rd element of a std::vector: auto val1 = vec[3]; /
by criddell 5mo ago
Sometimes there are ways of getting runtime bounds checking.
For example, both of these return the 3rd element of a std::vector:
auto val1 = vec[3]; // no bounds checking
auto val2 = vec.at(3); // bounds checking
- Mond_ 5mo agoYes, with the trade-off of essentially requiring exceptions, which are also banned in some codebases.