Re: quantlib Handle compile error
Posted by
P Nelnik on
May 24, 2010; 7:30am
URL: http://quantlib.414.s1.nabble.com/quantlib-Handle-compile-error-tp7722p7724.html
Thanks Luigi and Simons (I & II) for your responses.
A couple of suggestion:
1: perhaps we should change the code in Examples/EquityOption/EquityOption.cpp:
Handle<YieldTermStructure> flatTermStructure(
boost::shared_ptr<YieldTermStructure>( new FlatForward(settlementDate, riskFreeRate, dayCounter)));
since it may leak memory and it sets a bad example.
2: When a developer tries to implement Handle<T> where T doesn't derive from Observable,
he's told there is an error in:
inline void Handle<T>::Link::linkTo(const boost::shared_ptr<T>& h, bool registerAsObserver) {
A one line comment in that could warning developers that T must derive from Observable
Cheers
Philip
On Mon, May 24, 2010 at 2:52 PM, Luigi Ballabio
<[hidden email]> wrote:
On Mon, 2010-05-24 at 13:35 +0800, P Nelnik wrote:
> When trying to use the quantlib Handle<.>, I got a compiler error:
>
> >c:\work\quantlib\quantlib-1.0.1\ql\handle.hpp(143) : error C2664:
> 'QuantLib::Observer::unregisterWith' : cannot convert parameter 1 from
> 'boost::shared_ptr<T>' to 'const boost::shared_ptr<T> &'
The implementation of Handle<T> requires T to inherit from Observable.
Luigi
--
Glendower: I can call spirits from the vasty deep.
Hotspur: Why, so can I, or so can any man;
But will they come when you do call for them?
-- King Henry the Fourth Part I, Act III, Scene I
------------------------------------------------------------------------------
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users