How can I make SourceInsight understand smart pointers?

寵の児 提交于 2019-12-06 16:28:10

问题


If my code uses smart pointers, navigation and completion don't work with SourceInsight. For example with this simple example code:

class test {
public:
    void fun(){}
};

int main() {
    boost::scoped_ptr<test> a;
    a->fun();
    return 0;
}

When I click fun() in main , SourceInsight tells me "symbol not found".

Is there something I should do to fix that, or does SourceInsight have limitations?


回答1:


So I've given this a try. Downloaded, virus-scanned, signed up for free trial, installed wine, run!

Now, I can make SourceInsight import the symbols from the Boost directories:

I then enter the path to my Boost directory: Z:\home\sehe\custom\boost\

Processing takes a minute or two:

Seems ok:


Now if you import these symbols in your project:

You will find you can navigate to boost::scoped_ptr<> just fine (I double-clicked on the a in the declaration of a):

But it will not find references to fun:

Finds only the declaration:

Of course you can use simple string search, but that wasn't the point.

Here's the HTML export: https://s3.amazonaws.com/stackoverflow-sehe/f14b4ee2-9b4d-49cd-893d-cf69372dd586/HTML/test.cpp.html

Conclusion

It seems this is a limitation of SourceInsight, not due to misconfiguration.



来源:https://stackoverflow.com/questions/47204688/how-can-i-make-sourceinsight-understand-smart-pointers

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!