3 ms·
The point is to have some code that exhibits what happens when a bound check is needed. You can also do for(double v : std::span(vec).subspan(1)) { } in
by jcelerier 5y ago
The point is to have some code that exhibits what happens when a bound check is needed. You can also do
for(double v : std::span(vec).subspan(1)) { }
in C++ and that will be safe and not need a bound check except an user-provided one at the creation of the span (-1 for C++ here :-)) - and also not matter at all regarding the bound checks problem which will occur as soon as you don't just iterate linearly which is extremely common in the kind of problems that end up showing at the top of the profiler and the whole point of this conversation.