for(std::vector<TMenuItem*>::iterator itItem=miMoreStylesArray.begin(); itItem<miMoreStylesArray.end(); itItem++) {
If std::iterator is being fazed out, then what do I use instead to iterate through vector?
for(std::vector<TMenuItem*>::iterator itItem=miMoreStylesArray.begin(); itItem<miMoreStylesArray.end(); itItem++) {
If std::iterator is being fazed out, then what do I use instead to iterate through vector?
std::iterator
has nothing to do with the iterators of standard library containers, such as std::vector
.
While it is true that std::iterator
is deprecated, std::vector<TMenuItem*>::iterator
is certainly not.
The deprecation of std::iterator
is only relevant to you if you used it as a base class to implement your own custom iterator class.
The use of std::iterator
was in order to assist you in implementing iterator traits.
However, you can easily implement your iterator and its inner traits by yourself without the need of std::iterator
, see: Preparation for std::iterator Being Deprecated.
The iterators inside the standard containers remain untouched, as is. Note that they are declared inside their respective containers (e.g. vector<T>::iterator
) and not inside std directly.