C++ Does Not Name A Type

2019-09-03 06:23发布

问题:

I get confused when I get errors like these

I have

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

FxGlobalPair pair(id,able);

I get an error on FxGlobalPair pair(id,able); that is able is not a type.

I tried modifying to

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

but I get an error that is error: 'class FxSmartPtr<FxStreamable>::able' has not been declared

What concept am I missing?

UPDATE: typedef pair<FxID, FxSmartPtr<FxStreamable> > FxGlobalPair;

UPDATE 2:

Heading

回答1:

I think that you have found the Most Vexing parse

The problem is that

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

may define a function named able, instead of a variable.