Date: Wed, 4 May 2022 15:43:54 -0400
I like the way that std::map gives the key and value for ranged loops:
for (auto& [key, value] : my_map)
Why don't other containers allow for the "index" to also be gotten in a
similar way?
for (auto& [index, value] : any_container) would be convenient to have as
well.
Or, can this be done, but I'm just unaware? Thanks in advance.
Joey
for (auto& [key, value] : my_map)
Why don't other containers allow for the "index" to also be gotten in a
similar way?
for (auto& [index, value] : any_container) would be convenient to have as
well.
Or, can this be done, but I'm just unaware? Thanks in advance.
Joey
Received on 2022-05-04 19:44:06