如果我想使用来自模板派生类的模板基类的成员,我必须将它带入范围:
template <typename T>
struct base
{
void foo();
};
template <typename T>
struct derived : base<T>
{
using base<T>::foo;
};
为什么我不能像其他 using 语句一样将此 using 语句放入本地范围?
template <typename T>
struct base
{
void foo();
};
template <typename T>
struct derived : base<T>
{
void f()
{
using base<T>::foo; // ERROR: base<T> is not a namespace
}
};