问题
Is there any difference between using a type alias and alias template on the one hand and using-declaration on the other hand defined as follows:
Given a class definition in a namespace scope:
namespace ns1
{
template< typename T >
struct A {};
}
And given another namespace, which introduces the A
symbol by two different ways. First of them is type alias (alias template):
namespace ns2
{
template< typename T >
using A = ns1::A< T >; // match type-id
}
Second one is using-declaration:
namespace ns2
{
using ns1::A;
}
Is there any difference for ADL and for any other using contexts in ns1
scope (reopened), in ns2
scope or in outer scope?
来源:https://stackoverflow.com/questions/33602658/difference-between-type-alias-and-using-declaration