The scope resolution operator only specifies where to look for a name. So tuple_size<tupleType>::value
means to look for the name value
inside the class tuple_size<tupleType>
. Scope resolution doesn't care what the name denotes, it only deals with where it is looked up.
The place where the name is used, is what determines whether or not it is a valid use.
In the first case, it is used in a declaration as an initializer, so it must name a value to be valid, and the compiler will complain if it doesn't. While in the second case, it is used in a declaration to name a type (iterator
). Again, the compiler can check it is indeed a type once it examines the declaration and knows it should be one.
That is a slight simplification, of course. In the definition of templates, where those names are dependent on template parameters, the meaning can change. So we must specify explicitly what we expect those names to be, as detailed here.