C++ 不命名类型

标签 c++ types compiler-errors

当我遇到这样的错误时我会感到困惑

我有

FxSmartPtr<FxStreamable> able(FcNew,stream->StreamInObject());

FxGlobalPair pair(id,able);

我在 FxGlobalPair pair(id,able); 上遇到错误那是 able is not a type .

我尝试修改为

FxGlobalPair pair(id,FxSmartPtr<FxStreamable>::able);

但我得到一个错误 error: 'class FxSmartPtr<FxStreamable>::able' has not been declared

我错过了什么概念?

更新:typedef pair<FxID, FxSmartPtr<FxStreamable> > FxGlobalPair;

更新 2:

标题

最佳答案

我认为您已经找到了 Most Vexing parse

问题是

FxSmartPtr able(FcNew,stream->StreamInObject());

可以定义一个名为 able 的函数,而不是一个变量。

关于C++ 不命名类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6153782/

相关文章:

typescript - TypeScript 中具有条件类型返回类型的函数的最小实现

c++ - 如何在 C++ 中将复杂的<float>变量转换为 float ?

c++ - 如何声明 std::vector of boost histograms ? boost 直方图的类型是什么?

c++ - 确保文件扩展名与 C++ 中的文件类型匹配

c++ - 聪明的 if/else 结构

java - 意外类型所需变量找到的值

java - 如何修复 “error: cannot find symbol”

c# - 框架资源提取失败。找不到路径的一部分。 AbstractionsStrings.resw

c++ - 在基类中调用真正的虚函数

c++ - 使用 cmake 在 C++ 项目中包含 Caffe 时出错