Login  Register

class Instrument, virtual destructor

classic Classic list List threaded Threaded
4 messages Options Options
Embed post
Permalink
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

class Instrument, virtual destructor

Kim Kuen Tang
92 posts
Hi all,

 the class Instrument is defined as an abstract class. For that reason
it should be provided with a virtual destructor

virtual ~Instrument(){};

to avoid memory leak. I hope that someone can add  this to the file.

with regards,
Kim Tang

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: class Instrument, virtual destructor

Luigi Ballabio
3579 posts

On Sep 3, 2008, at 7:46 PM, Kim Kuen Tang wrote:
> the class Instrument is defined as an abstract class. For that reason
> it should be provided with a virtual destructor
>
> virtual ~Instrument(){};
>
> to avoid memory leak. I hope that someone can add  this to the file.

Kim,
        the Instrument class inherits from LazyObject, which defines a  
virtual destructor.  Therefore, there's no need to declare one in  
Instrument.

Luigi


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: class Instrument, virtual destructor

Kim Kuen Tang
92 posts
Hi Luigi,

you are right. I have forgotten that every derived class will
automatically have a virtual destructor if the base class has a virtual
destructor.

Btw,  a colleague and me have written seveal methods( Gausskronrod
,trapezoid,...) (implemented using abstract class) to integrate over a 2
dimensional boost::function<Real (Real,Real)>.
And we would like to contribute it to QuantLib. Would u please tell me
what to do next? Or where can i read the detail?

with regards,
Kim Tang

Luigi Ballabio schrieb:

>
> On Sep 3, 2008, at 7:46 PM, Kim Kuen Tang wrote:
>> the class Instrument is defined as an abstract class. For that reason
>> it should be provided with a virtual destructor
>>
>> virtual ~Instrument(){};
>>
>> to avoid memory leak. I hope that someone can add  this to the file.
>
> Kim,
>     the Instrument class inherits from LazyObject, which defines a
> virtual destructor.  Therefore, there's no need to declare one in
> Instrument.
>
> Luigi
>
>


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: class Instrument, virtual destructor

Luigi Ballabio
3579 posts

On Sep 4, 2008, at 7:20 PM, Kim Kuen Tang wrote:
> Btw,  a colleague and me have written seveal  
> methods( Gausskronrod ,trapezoid,...) (implemented using abstract  
> class) to integrate over a 2 dimensional boost::function<Real  
> (Real,Real)>.
> And we would like to contribute it to QuantLib. Would u please tell  
> me what to do next? Or where can i read the detail?

You can send the code to me, or add it to the Sourceforge patch  
manager (<https://sourceforge.net/tracker/?group_id=12740&atid=312740>.)

Also, we should make sure that your employer is OK with this,  
especially if you developed the code at work. It would be best if you  
could get a written statement from your manager that allows you to  
contribute.

Thanks,
        Luigi



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users