STL - Why Use a Scope Resolution Operator for an Iterator

To access the STL iterator, why do I need a region resolution operator, not a point operator? Is it because the iterator is static and does not belong to a specific instance of the class?

vector<int>::iterator my_iterator;

but not

vector<int> numbers;
numbers.iterator;
+4
source share
2 answers

The Dot and arrow ( ->) operators are used to access all data (member variables, functions) specific to a given instance.

( -, , ), , . : , type::member_type .

+9

a::b ; a.b . my_iterator - , vector<int>::iterator - .

+1

All Articles