Search code examples
c++c++11typestypedefusing

Can "using" fully replace "typedef" in all cases?


I know using can do something typedef cannot do.

I just wonder whether using can fully replace typedef in all cases?


Solution

  • Yes it can, quote from the draft Standard (bold emphasis mine)

    7.1.3 The typedef specifier [dcl.typedef]

    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.