c++ - 在 Visual Studio 2008 中使用 Boost 1.40.0 的 boost::shared_ptr 的 Intellisense 失败

标签 c++ visual-studio-2008 boost intellisense shared-ptr

我无法让智能感知自动完成 boost 1.40.0 的共享指针。 (它适用于 Boost 1.33.1。)这是一个简单的示例项目文件,其中自动完成不起作用:

#include <boost/shared_ptr.hpp>

struct foo
{ bool func() { return true; }; };

void bar() {
    boost::shared_ptr<foo> pfoo;
    pfoo.get();      // <-- intellisense does not autocomplete after "pfoo."
    pfoo->func();    // <-- intellisense does not autocomplete after "pfoo->"
}

当我右键单击 shared_ptr 并执行“转到定义”时,它会将我带到 <boost/exception/exception.hpp> 中 shared_ptr 类的前向声明。 .它没有让我看到实际的定义,它在 <boost/smart_ptr/shared_ptr.hpp> 中.但是,它编译得很好,并且自动完成对于“boost::”工作得很好。此外,自动完成功能适用于 boost::scoped_ptr 和 boost::shared_array。

有什么想法吗?

最佳答案

Intellisense 有自己的编译器,可以容忍代码错误(它必须能够理解不完整的代码),但有时根本无法正确解析正确的代码。后者对于要求苛刻的模板代码尤其如此(boost 因其而臭名昭著)。

要么忍受它,要么等到 Intellisense 使用“普通”编译器(宣布是为 VC10 还是之后的版本发布的?),或者试试 Visual Assist的最新版本更好。

关于c++ - 在 Visual Studio 2008 中使用 Boost 1.40.0 的 boost::shared_ptr 的 Intellisense 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2580916/

相关文章:

c++ - Sizeof 报告类型定义结构的大小不正确 - C++

c++ - 使用两个不同版本的boost

c++ - extern "C"静态数组函数参数

c++ - 如何从powerbuilder11.5调用win32 dll?

c# - 在线程内 sleep 的替代方法

C++检查模板参数的嵌套typedef以获得其标量基类型

java - 无法写入核心转储。核心转储已被禁用

c++ - 在C++中打印pow()函数的精确值

c++ - 此错误消息是什么意思?

c# - 如何在简单的 Web 项目中连接到 .mdf(Microsoft SQL Server 数据库文件)?