从模板访问模板定义?

时间:2014-04-04 19:38:48

标签: c++

尝试使用在作为模板参数本身传递的类中定义的模板。 typename说明符显然是不正确的,但如果我尝试在那里使用模板,我只会得到其他错误。

struct Tee
{
    template<typename T = int> class Bar { };
};

template<typename T>
struct Foo
{
    typename T::Bar<> f; // *error non-template used as template
};

int main() {
    Foo<Tee> foo;

    return 0;
}

0 个答案:

没有答案
相关问题