This is fully consistent with the name, so only the vector template in the std in the global namespace is used. This basically means:
{global namespace}::std::vector<myclass> myvec;
There may be a difference when you have objects with the same name in different namespaces. For a simple example, when this may make a difference, consider:
#include <vector> namespace ns { namespace std { template <typename T> class vector { }; } void f() { std::vector<int> v1; // refers to our vector defined above ::std::vector<int> v2; // refers to the vector in the Standard Library } };
Since you are not allowed to define your own entities in the std , it is guaranteed that ::std::vector will always refer to the standard library container. std::vector may refer to something else.,
James McNellis
source share