[Solved] why do we put :: (scope resoulation operator) before iterator? [closed]


std is a namespace.
std::vector is a class template in the std namespace, which makes std::vector<double> a class.
std::vector<T>::iterator is a nested type under std::vector<T>.

If you want to define an object of type std::vector<double>, you use:

std::vector<double> obj;

If you want to define an object of type std::vector<double>::iterator, you use:

std::vector<double>::iterator iter;

2

solved why do we put :: (scope resoulation operator) before iterator? [closed]