What is the difference between ‘typedef’ and ‘using’ in C++11?

They are equivalent, from the standard (emphasis mine) (7.1.3.2):

A typedef-name can also be introduced by an alias-declaration. The
identifier following the using keyword becomes a typedef-name and the
optional attribute-specifier-seq following the identifier appertains
to that typedef-name. It has the same semantics as if it were
introduced by the typedef specifier.
In particular, it
does not define a new type and it shall not appear in the type-id.

Leave a Comment