Template class inheritance

Joined
May 23, 2007
Messages
1
Reaction score
0
Hi group,

I am experiencing some problems when compiling my code. More precisely there is a problem in the constructor of my inherited template class.

template <class USG, class IC>
class InverseCumulativeChiSquareRsg:public QuantLib::InverseCumulativeRsg< USG, IC> {
public :
explicit InverseCumulativeChiSquareRsg(const USG& uniformSequenceGenerator) ;
InverseCumulativeChiSquareRsg(const USG& uniformSequenceGenerator,const IC& inverseCumulative); //<----the problem is here!!!
const sample_type& nextSequence() const;
private :
mutable sample_type xChiSquare_ ;
};

Now, the constructor for QuantLib::InverseCumulativeRsg< USG, IC> is defined as

template <class USG, class IC>
InverseCumulativeRsg<USG, IC>::InverseCumulativeRsg(const USG& usg,
const IC& inverseCum)
: uniformSequenceGenerator_(usg),
dimension_(uniformSequenceGenerator_.dimension()),
x_(Array(dimension_), 1.0),
ICD_(inverseCum) {}

and of course it works perfectly.

x_ is defined as private member of InverseCumulativeRsg<USG, IC> in such a way:

typedef Sample<Array> sample_type;
mutable sample_type x_;

So, the error I get is

'QuantLib::Sample<T>' : no appropriate default constructor available
with
[
T=QuantLib::Array
]

which for some reasons that I can't understand happens only when I try to instantiate the inherited class!
Any help or idea will be much appreciated!

Thanks,

Andrea
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,772
Messages
2,569,593
Members
45,111
Latest member
VetaMcRae
Top