make visible all names from namespace
No, because T
isn't a namespace. You can't derive from a namespace.
The using
keyword has more than one meaning.
You're thinking of the using directive for namespaces, but the using declaration works for both namespace members (at namespace scope) and class members (inside a class). Since we already established T
is not a namespace, this is obviously the second case.
Inside a class using T::member
would normally just prevent base-class names being hidden by the derived class, but T::T
means the base class constructor, which as a special case inherits constructors from T.
template <typename T> struct counted : T
{
using T::T; // now counted<T> can directly use any of T's constructors
};