我在Eclipse CDT索引器/代碼分析器中遇到問題。當我在編輯器中編寫以下代碼時,它會在const int* p = x.f();
- Invalid arguments Candidates are: int * f()
上顯示錯誤。因此,對於某種原因,它不會在B類識別方法const T* f() const
Eclipse CDT無法解析模板類中的方法
template<typename T>
class A {
public:
const T* f() const { return 0; }
};
template<typename T>
class B : A<T> {
public:
using A<T>::f;
T* f() { return 0; }
};
void main() {
const B<int> x;
const int* p = x.f();
}
它爲什麼會發生,以及如何解決這個問題的任何想法?