Re:You've just inherited a legacy C++ codebase, now what?
by z_open on Friday March 01, 2024 @03:17AM
(#39559708)
This is not idiomatic C++ in any C++ standard. You can also just replace vector with map so the brackets insert, but that isn't either.
[ Parent
| on HN ]
Re:You've just inherited a legacy C++ codebase, now what?
by bluGill on Friday March 01, 2024 @08:28AM
(#39561560)
Prefer at to [] is standard where I write C++. map is not standard because vector is almost always much faster random access in the real world (that is n is normally small enough that a linear search is faster than a binary search because of caching)