Boost version

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Boost version

Luigi Ballabio
Hi all,
    I was thinking of requiring at least Boost 1.39, mostly so that we
can use boost::make_shared (*).  It was released in May 2009, so I'm
assuming most of us has moved forward. Is anybody still stuck with an
earlier version and opposed to the change?

Luigi

(*) what and why:
<http://www.boost.org/doc/libs/1_55_0/libs/smart_ptr/make_shared.html>
<http://herbsutter.com/2013/05/29/gotw-89-solution-smart-pointers/>


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

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Boost version

Peter Caspers-4
Hi Luigi,

I try to use boost::make_shared to create a shared pointer to a
PiecewiseYieldCurve. I thought code like

    boost::shared_ptr<YieldTermStructure> yts1(
        new PiecewiseYieldCurve<Discount, LogLinear>(
            0, WeekendsOnly(), isdaRateHelper, Actual365Fixed()));

should work similar to

    boost::shared_ptr<YieldTermStructure> yts2 =
        boost::make_shared<PiecewiseYieldCurve<Discount, LogLinear> >(
            PiecewiseYieldCurve<Discount, LogLinear>(
                0, WeekendsOnly(), isdaRateHelper, Actual365Fixed()));

Yet while the first variant works fine, the second variant throws an exception

terminate called after throwing an instance of 'QuantLib::Error'
  what():  not enough points to interpolate: at least 2 required, 0 provided

Do you know why or what I am doing wrong ? I attach the complete
example. The output I get from this is

setting up discount curve
test discount variant 1 = 0.980123
terminate called after throwing an instance of 'QuantLib::Error'
  what():  not enough points to interpolate: at least 2 required, 0 provided

Thanks
Peter

On 29 November 2013 13:07, Luigi Ballabio <[hidden email]> wrote:

> Hi all,
>     I was thinking of requiring at least Boost 1.39, mostly so that we
> can use boost::make_shared (*).  It was released in May 2009, so I'm
> assuming most of us has moved forward. Is anybody still stuck with an
> earlier version and opposed to the change?
>
> Luigi
>
> (*) what and why:
> <http://www.boost.org/doc/libs/1_55_0/libs/smart_ptr/make_shared.html>
> <http://herbsutter.com/2013/05/29/gotw-89-solution-smart-pointers/>
>
>
> --
> <https://implementingquantlib.blogspot.com>
> <https://twitter.com/lballabio>
>
> ------------------------------------------------------------------------------
> Rapidly troubleshoot problems before they affect your business. Most IT
> organizations don't have a clear picture of how application performance
> affects their revenue. With AppDynamics, you get 100% visibility into your
> Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
> http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users

------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today.
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users

test.cpp (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Fwd: Boost version

Peter Caspers-4
oh, sorry, it should rather be

    boost::shared_ptr<YieldTermStructure> yts2 =
        boost::make_shared<PiecewiseYieldCurve<Discount, LogLinear> >(
            0, WeekendsOnly(), isdaRateHelper, Actual365Fixed());

and this indeed works.

Peter

---------- Forwarded message ----------
From: Peter Caspers <[hidden email]>
Date: 11 January 2014 18:46
Subject: Re: [Quantlib-users] Boost version
To: Luigi Ballabio <[hidden email]>
Cc: QuantLib users <[hidden email]>


Hi Luigi,

I try to use boost::make_shared to create a shared pointer to a
PiecewiseYieldCurve. I thought code like

    boost::shared_ptr<YieldTermStructure> yts1(
        new PiecewiseYieldCurve<Discount, LogLinear>(
            0, WeekendsOnly(), isdaRateHelper, Actual365Fixed()));

should work similar to

    boost::shared_ptr<YieldTermStructure> yts2 =
        boost::make_shared<PiecewiseYieldCurve<Discount, LogLinear> >(
            PiecewiseYieldCurve<Discount, LogLinear>(
                0, WeekendsOnly(), isdaRateHelper, Actual365Fixed()));

Yet while the first variant works fine, the second variant throws an exception

terminate called after throwing an instance of 'QuantLib::Error'
  what():  not enough points to interpolate: at least 2 required, 0 provided

Do you know why or what I am doing wrong ? I attach the complete
example. The output I get from this is

setting up discount curve
test discount variant 1 = 0.980123
terminate called after throwing an instance of 'QuantLib::Error'
  what():  not enough points to interpolate: at least 2 required, 0 provided

Thanks
Peter

On 29 November 2013 13:07, Luigi Ballabio <[hidden email]> wrote:

> Hi all,
>     I was thinking of requiring at least Boost 1.39, mostly so that we
> can use boost::make_shared (*).  It was released in May 2009, so I'm
> assuming most of us has moved forward. Is anybody still stuck with an
> earlier version and opposed to the change?
>
> Luigi
>
> (*) what and why:
> <http://www.boost.org/doc/libs/1_55_0/libs/smart_ptr/make_shared.html>
> <http://herbsutter.com/2013/05/29/gotw-89-solution-smart-pointers/>
>
>
> --
> <https://implementingquantlib.blogspot.com>
> <https://twitter.com/lballabio>
>
> ------------------------------------------------------------------------------
> Rapidly troubleshoot problems before they affect your business. Most IT
> organizations don't have a clear picture of how application performance
> affects their revenue. With AppDynamics, you get 100% visibility into your
> Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
> http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users

------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today.
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users

test.cpp (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Fwd: Boost version

Peter Caspers-4
but ... does that nevertheless point to a problem with the copy
constructor of PiecewiseYieldCurve ?
which is probably not very relevant, still we could disable it (and
the assignment operator) for safety reasons ?
Peter

---------- Forwarded message ----------
From: Peter Caspers <[hidden email]>
Date: 11 January 2014 18:55
Subject: Fwd: [Quantlib-users] Boost version
To: Luigi Ballabio <[hidden email]>, QuantLib users
<[hidden email]>


oh, sorry, it should rather be

    boost::shared_ptr<YieldTermStructure> yts2 =
        boost::make_shared<PiecewiseYieldCurve<Discount, LogLinear> >(
            0, WeekendsOnly(), isdaRateHelper, Actual365Fixed());

and this indeed works.

Peter

---------- Forwarded message ----------
From: Peter Caspers <[hidden email]>
Date: 11 January 2014 18:46
Subject: Re: [Quantlib-users] Boost version
To: Luigi Ballabio <[hidden email]>
Cc: QuantLib users <[hidden email]>


Hi Luigi,

I try to use boost::make_shared to create a shared pointer to a
PiecewiseYieldCurve. I thought code like

    boost::shared_ptr<YieldTermStructure> yts1(
        new PiecewiseYieldCurve<Discount, LogLinear>(
            0, WeekendsOnly(), isdaRateHelper, Actual365Fixed()));

should work similar to

    boost::shared_ptr<YieldTermStructure> yts2 =
        boost::make_shared<PiecewiseYieldCurve<Discount, LogLinear> >(
            PiecewiseYieldCurve<Discount, LogLinear>(
                0, WeekendsOnly(), isdaRateHelper, Actual365Fixed()));

Yet while the first variant works fine, the second variant throws an exception

terminate called after throwing an instance of 'QuantLib::Error'
  what():  not enough points to interpolate: at least 2 required, 0 provided

Do you know why or what I am doing wrong ? I attach the complete
example. The output I get from this is

setting up discount curve
test discount variant 1 = 0.980123
terminate called after throwing an instance of 'QuantLib::Error'
  what():  not enough points to interpolate: at least 2 required, 0 provided

Thanks
Peter

On 29 November 2013 13:07, Luigi Ballabio <[hidden email]> wrote:

> Hi all,
>     I was thinking of requiring at least Boost 1.39, mostly so that we
> can use boost::make_shared (*).  It was released in May 2009, so I'm
> assuming most of us has moved forward. Is anybody still stuck with an
> earlier version and opposed to the change?
>
> Luigi
>
> (*) what and why:
> <http://www.boost.org/doc/libs/1_55_0/libs/smart_ptr/make_shared.html>
> <http://herbsutter.com/2013/05/29/gotw-89-solution-smart-pointers/>
>
>
> --
> <https://implementingquantlib.blogspot.com>
> <https://twitter.com/lballabio>
>
> ------------------------------------------------------------------------------
> Rapidly troubleshoot problems before they affect your business. Most IT
> organizations don't have a clear picture of how application performance
> affects their revenue. With AppDynamics, you get 100% visibility into your
> Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
> http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users

------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today.
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users

test.cpp (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Boost version

Luigi Ballabio
I though it was disabled already. Let me check... no, it's not. It
used to be, though.
I'll have a look and try to understand what happens...

Luigi

On Sat, Jan 11, 2014 at 7:41 PM, Peter Caspers <[hidden email]> wrote:

> but ... does that nevertheless point to a problem with the copy
> constructor of PiecewiseYieldCurve ?
> which is probably not very relevant, still we could disable it (and
> the assignment operator) for safety reasons ?
> Peter
>
> ---------- Forwarded message ----------
> From: Peter Caspers <[hidden email]>
> Date: 11 January 2014 18:55
> Subject: Fwd: [Quantlib-users] Boost version
> To: Luigi Ballabio <[hidden email]>, QuantLib users
> <[hidden email]>
>
>
> oh, sorry, it should rather be
>
>     boost::shared_ptr<YieldTermStructure> yts2 =
>         boost::make_shared<PiecewiseYieldCurve<Discount, LogLinear> >(
>             0, WeekendsOnly(), isdaRateHelper, Actual365Fixed());
>
> and this indeed works.
>
> Peter
>
> ---------- Forwarded message ----------
> From: Peter Caspers <[hidden email]>
> Date: 11 January 2014 18:46
> Subject: Re: [Quantlib-users] Boost version
> To: Luigi Ballabio <[hidden email]>
> Cc: QuantLib users <[hidden email]>
>
>
> Hi Luigi,
>
> I try to use boost::make_shared to create a shared pointer to a
> PiecewiseYieldCurve. I thought code like
>
>     boost::shared_ptr<YieldTermStructure> yts1(
>         new PiecewiseYieldCurve<Discount, LogLinear>(
>             0, WeekendsOnly(), isdaRateHelper, Actual365Fixed()));
>
> should work similar to
>
>     boost::shared_ptr<YieldTermStructure> yts2 =
>         boost::make_shared<PiecewiseYieldCurve<Discount, LogLinear> >(
>             PiecewiseYieldCurve<Discount, LogLinear>(
>                 0, WeekendsOnly(), isdaRateHelper, Actual365Fixed()));
>
> Yet while the first variant works fine, the second variant throws an exception
>
> terminate called after throwing an instance of 'QuantLib::Error'
>   what():  not enough points to interpolate: at least 2 required, 0 provided
>
> Do you know why or what I am doing wrong ? I attach the complete
> example. The output I get from this is
>
> setting up discount curve
> test discount variant 1 = 0.980123
> terminate called after throwing an instance of 'QuantLib::Error'
>   what():  not enough points to interpolate: at least 2 required, 0 provided
>
> Thanks
> Peter
>
> On 29 November 2013 13:07, Luigi Ballabio <[hidden email]> wrote:
>> Hi all,
>>     I was thinking of requiring at least Boost 1.39, mostly so that we
>> can use boost::make_shared (*).  It was released in May 2009, so I'm
>> assuming most of us has moved forward. Is anybody still stuck with an
>> earlier version and opposed to the change?
>>
>> Luigi
>>
>> (*) what and why:
>> <http://www.boost.org/doc/libs/1_55_0/libs/smart_ptr/make_shared.html>
>> <http://herbsutter.com/2013/05/29/gotw-89-solution-smart-pointers/>
>>
>>
>> --
>> <https://implementingquantlib.blogspot.com>
>> <https://twitter.com/lballabio>
>>
>> ------------------------------------------------------------------------------
>> Rapidly troubleshoot problems before they affect your business. Most IT
>> organizations don't have a clear picture of how application performance
>> affects their revenue. With AppDynamics, you get 100% visibility into your
>> Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
>> http://pubads.g.doubleclick.net/gampad/clk?id=84349351&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>

------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today.
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users