Possible Duplicate:
Where and why do I have to put the “template” and “typename” keywords?
I have a template type defined as follows:
template<class TCoupon>
class CatBond : public Instrument {
public:
class arguments;
class engine;
//actual content
}
And then I want to do this:
template<class TCoupon>
class CatBond<TCoupon>::engine :
public GenericEngine<CatBond<TCoupon>::arguments,
CatBond<TCoupon>::results> {};
where the GenericEngine is defined in the QuantLib library I am trying to work with as follows:
template<class ArgumentsType, class ResultsType>
class GenericEngine : public PricingEngine,
public Observer {
public:
PricingEngine::arguments* getArguments() const { return &arguments_; }
const PricingEngine::results* getResults() const { return &results_; }
void reset() { results_.reset(); }
void update() { notifyObservers(); }
protected:
mutable ArgumentsType arguments_;
mutable ResultsType results_;
};
However, this doesn't compile:
Warning 1 warning C4346: 'Oasis::CatBond<TCoupon>::arguments' : dependent name is not a type c:\users\ga1009\documents\dev\oasis\catbonds\CatBond.h 213
Error 2 error C2923: 'QuantLib::GenericEngine' : 'Oasis::CatBond<TCoupon>::arguments' is not a valid template type argument for parameter 'ArgumentsType' c:\users\ga1009\documents\dev\oasis\catbonds\CatBond.h 213
how can I make it work? This construct worked nicely when CatBond was a concrete type.