This is not a question about the difference between using
and typedef
for creating type aliases. I would like to provide access to an existing type from a namespace inside a code block or a function.
I found two different ways :
I can "include" the type with a using declaration :
using typename mynamespace::mytype;
Or I can create a type alias :
typedef mynamespace::mytype mytype;
using mytype = mynamespace::mytype; //C++11
- Is there any difference ?
- What are the pros and cons of each syntax ?
- Which one is the most used/recommended ?
Thank you.
Related question : Using-declaration of an existing type from base class vs creating a type alias inside child class