Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 786
xmllmx Avatar asked Sep 14 '13 09:09

xmllmx


1 Answers

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.

like image 133
TemplateRex Avatar answered Sep 20 '22 02:09

TemplateRex