gpt4 book ai didi

c++ - 奇怪的 GCC 'expected primary expression...' 错误

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:54:41 25 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
Templates: template function not playing well with class’s template member function

template <typename T>
struct A
{
template <int I>
void f();
};

template <typename T>
void F(A<T> &a)
{
a.f<0>(); // expected primary-expression before ‘)’ token
}

int main()
{
A<int> a;

a.f<0>(); // This one is ok.
}

这是怎么回事?

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com