You can read typedef typename std::vector::size_type size_type like this:
typedeftypename std::vector::size_typesize_type, just like typedef __int64 INT64.
Why we need typename beforce std::vector::size_type? It just tells the compiler that std::vector::size_type is a type not a normal class member. It's used for disambiguation.
But I think maybe some compiler can auto detect std::vector::size_type is a type.
So, typedef just creates an alias for an existing type, and typename tells the compile that std::vector::size_type is a type not a normal class member.
You can read
typedef typename std::vector::size_type size_type
like this:typedef
typename std::vector::size_type
size_type
, just liketypedef __int64 INT64
.Why we need
typename
beforcestd::vector::size_type
? It just tells the compiler thatstd::vector::size_type
is a type not a normal class member. It's used for disambiguation.But I think maybe some compiler can auto detect
std::vector::size_type
is a type.So,
typedef
just creates an alias for an existing type, andtypename
tells the compile thatstd::vector::size_type
is a type not a normal class member.