Re: interpolation error

Posted by Luigi Ballabio on
URL: http://quantlib.414.s1.nabble.com/interpolation-error-tp15864p15877.html

Hello,
    the line that's giving the problem is not the one where you build
the interpolation, it's the line

LinearInterpolation optionInterpolator_;

where you declare it. As the compiler says, I'm guessing the code that
builds the interpolation is inside the body of a constructor; but
before executing the body, the data members must be initialized.
LinearInterpolation doesn't have a default constructor, so that's not
possible. Instead, you can declare the data member as just:

Interpolation optionInterpolator_;

The above can be default-constructed, and you'll be able to assign to
it a LinearInterpolation anyway.

Luigi



On Mon, Sep 15, 2014 at 9:43 PM, Grison PG Pierre (External DEXIA-US)
<[hidden email]> wrote:

> Hello,
>
>
>
> Does anyone have an idea why the following code line
>
>
>
> optionInterpolator_= LinearInterpolation(optionTimes_.begin(),
> optionTimes_.end(),
>
>                            optionDatesAsReal_.begin());
>
>
>
> where optionInterpolator_ is declared as
>
>
>
> LinearInterpolation optionInterpolator_;
>
>
>
> And inputs are declared as
>
>
>
>                      mutable std::vector<Date> optionDates_;
>
>                      mutable std::vector<Time> optionTimes_;
>
>
>
>
>
>
>
> triggers the compile error
>
>
>
> 'QuantLib::LinearInterpolation' : no appropriate default constructor
> available
>
>
>
> Thanks,
>
>
>
> Pierre
>
>
>
>
> ------------------------------------------------------------------------------
> Want excitement?
> Manually upgrade your production database.
> When you want reliability, choose Perforce
> Perforce version control. Predictably reliable.
> http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>



--
<https://implementingquantlib.blogspot.com>
<https://twitter.com/lballabio>

------------------------------------------------------------------------------
Slashdot TV.  Video for Nerds.  Stuff that Matters.
http://pubads.g.doubleclick.net/gampad/clk?id=160591471&iu=/4140/ostg.clktrk
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users