A point from ISO draft n3290 section 3.3.9 paragraph 4:
The declarative region of the name of a template parameter is nested within the immediately-enclosing declarative region.[Note: As a result, a template-parameter hides any entity with the same name in an enclosing scope (3.3.10).
Example:
typedef int N;
template<N X, typename N, template<N Y> class T> struct A;
Can any one please ....tell some other example other than this ..where & where this situation erises
draft link n3290: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3290.pdf
, typename N,
in the template declaration ? – iammilindtypename
andclass
are equivalent, if that answers your question. If it does not, then it declares a type template argument namedN
, which in turns creates a local type aliasN
in the scope of the template to the type used as second argument to the template during instantiation. In that particular example, the intention is that asN
is also a type at namespace level, this parameter hides the typedef at namespace scope. – David Rodríguez - dribeas