Zebrafish
Zebrafish

Reputation: 14112

What is the proper/recommended way of getting an std::vector iterator now that std::vector::iterator is legacy?

From cppreference:

iterator    LegacyRandomAccessIterator
const_iterator  Constant LegacyRandomAccessIterator

Is it not supposed to be used anymore? What's the proper/recommended way of getting a std::vector iterator? Are we supposed to be using the only auto?

Upvotes: 4

Views: 138

Answers (1)

Jarvis
Jarvis

Reputation: 8564

Saying legacy doesn't mean that it's not supported or deprecated. It just means that it's not new, hence using the term legacy. Legacy prefix is used only to differentiate between C++20's RandomAccessIterator and the pre-existing LegacyRandomAccessIterator (both are "concepts" according to C++). I don't think the term Legacy is actually mentioned in the standard, though.

Upvotes: 5

Related Questions