Intellisense不工作与模板VS2012最终的c ++ [英] Intellisense not working with templates VS2012 ultimate c++

查看:518
本文介绍了Intellisense不工作与模板VS2012最终的c ++的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Intellisense对我的VS非常不利...

Intellisense is working very badly with my VS...

当我在C ++中编码时,它工作100%罚款,直到我开始使用模板,然后它只是停止工作完全,停止检测错误,并不会在所有情况下自动完成。

When I'm coding in C++ it works 100% fine, until I start using templates, then it just stops working completely, stops detecting errors and don't auto-complete in all cases.

我倾向于相信它与我做的事情我的代码打破了它。

I'm inclined to believe it has to do with something I have done with my code that broke it.

所以我开始创建一个结构类的类:

So I started by creating a class with a struct in it:

template<typename T>
class List<T>
{
private:
    struct Node
    {
        T value;
        Node* next;
        Node* previous;
    };
    Node* First;
    Node* Last;
...
};

稍后,我声明一些附加函数:

later, I declare some additional functions:

template<typename T>
inline T List::First()
{
    return First;
}

到目前为止很好,intellisense是100%正常工作,但如果我试试首先 - >它不会工作,VS不会告诉我任何选项(ctrl +空格不工作)。

so far so good, intellisense is working 100% fine, but if I try to do first-> it won't work, VS won't tell give me any options (ctrl + space doesn't work).

一些废话不会告诉我它是错误的:

also, if I type some nonsense it won't tell me it's wrong:

sdkjgisjdga->vsrsiib = 123jgi;

我真的不知道该怎么做才能解决这个问题。

I don't really know what to do in order to fix this.

感谢您的时间和精力。

PS:我已经尝试重设设定。

PS: I already tried to reset the configurations.

编辑:忘记说如果我不在我的.h文件中使用模板,那么intellisense工作正常。

Forgot to say that if i don't use templates in my .h file then intellisense works correctly.

推荐答案

模板需要被实例化,然后才能确定地说明它们包含什么。例如,您的 First-> 代码段指向 List< T> :: Node 取决于 T 的确切。

Templates need to be instantiated before you can definitively say what they contain. For example, your First-> snippet points to a List<T>::Node, and that is obviously dependent on the exact T.

当然,在这个简单的情况下,Intellisense可以通过替换 T == int 一会儿来清楚地列出成员。但是考虑更糟糕的是:Intellisense不知道成员(如现在)或Intellisense在你最需要的情况下的猜测错误?

Sure, Intellisense in this simple case could unambiguously list the members by just substituting T==int for a moment. But consider what's worse: Intellisense not knowing the members (like now) or Intellisense mis-guessing in the hard cases where you need it most?

这篇关于Intellisense不工作与模板VS2012最终的c ++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆