|
From: Andrea <mar...@go...> - 2010-01-18 22:14:37
|
On 17/01/10 21:31, Andrea wrote: > I would like to post 2 patches (one for QuantLib, the other for QuantLib-SWIG) to allow users to > implement a payoff entirely in a foreign language (e.g. Java). > These patches apply on top of the other patch I have just sent. > > By enabling directors the user can implement the "value" function in Java like it was a standard > subclass of a C++ class. > > The goal here is not speed :-) but ease of use, by writing a payoff in a language like Java or C#. > > There is also a simple example of an option that pays the running average on every fixing date. > > Everything works fine with the exception of the following issue. But I thought to post the code > since I could not find a better solution that what I have currently implemented. I've actually found a better solution, but it requires a global change in QuantLib-SWIG. > > I wish I had a shared_ptr<ExternalOption> but I only have a raw pointer or a reference. > > It is a problem similar to the original, but I found it is easier to manage. It is all down to the > use of shared_ptr in SWIG. > In SWIG there is already support for boost::shared_ptr<> that removes distinction between raw pointer, value, reference and smart pointer making it all easier. The problem is that QuantLib-SWIG uses a custom definition of boost::shared_ptr<> (in common.i). SWIG provides a "shared_ptr.i". Does anybody know why it is not used? Andrea |