当我遇到这样的错误时我会感到困惑
我有
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/