for (int i = 0; i < (int)vector.size(); i++) {
In old code, you should have used size_t i, then there's no need for the cast. Avoid casting if at all possible.
size_t i
for (auto [key, value] : map) {
It depends on the types of key and value because those are copied by value. For large-ish types, you probably want to do:
key
value
for (auto const &[key, value] : map ) {
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
In old code, you should have used
size_t i
, then there's no need for the cast. Avoid casting if at all possible.It depends on the types of
key
andvalue
because those are copied by value. For large-ish types, you probably want to do: