revisit - Error compiling QuantLib 3.10 in MSVC6 - 'back_inserter'

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

revisit - Error compiling QuantLib 3.10 in MSVC6 - 'back_inserter'

M L-3
Hi Folks,

This has been posted by someone else in the list, but I got the same error
and I do have vc60 sp6. any idea?

c:\program files\quantlib\ql\math\primenumbers.cpp(50) : error C2039:
'back_inserter' : is not a member of 'std'
c:\program files\quantlib\ql\math\primenumbers.cpp(50) : error C2065:
'back_inserter' : undeclared identifier


it happened in this part of primenumbers.cpp:

    BigNatural PrimeNumbers::get(Size absoluteIndex) {
        if (primeNumbers_.empty()) {
            Size n = sizeof(firstPrimes)/sizeof(firstPrimes[0]);
            std::copy(firstPrimes, firstPrimes+n,
                      std::back_inserter(primeNumbers_));
        }
        while (primeNumbers_.size()<=absoluteIndex)
            nextPrimeNumber();
        return primeNumbers_[absoluteIndex];
    }

however in other parts of the code: swaptionhelper.cpp and caphelper.cpp ,
it compiled fine.

many thanks

mike




Reply | Threaded
Open this post in threaded view
|

Re: revisit - Error compiling QuantLib 3.10 in MSVC6 - 'back_inserter'

Luigi Ballabio
On 09/19/2005 03:54:45 PM, M L wrote:
> Hi Folks,
>
> This has been posted by someone else in the list, but I got the same  
> error and I do have vc60 sp6. any idea?
>
> c:\program files\quantlib\ql\math\primenumbers.cpp(50) : error C2039:  
> 'back_inserter' : is not a member of 'std'
> c:\program files\quantlib\ql\math\primenumbers.cpp(50) : error C2065:  
> 'back_inserter' : undeclared identifier

Mike,
        try adding

#include <iterator>

to the includes at the beginning of the file.

Later,
        Luigi


----------------------------------------

All parts should go together without forcing.  You must remember that
the parts you are reassembling were disassembled by you.  Therefore, if
you can't get them together again, there must be a reason.  By all
means, do not use a hammer.
-- IBM maintenance manual, 1925



Reply | Threaded
Open this post in threaded view
|

question on AmericanOption.cpp

M L-3
Pardon me becasue this is not strictly a quantlib question, but a question
on equity option convention.

In the AmericanOption Class examples that come with the package, why is the
option calculated from settlementDate to exerciseDate? I thought the value
of the option was from trade date(todaysDate) to expiration(15 May, 2005,
not 17 May, 1998)? it seems like the example is counting the days from
settle to settle, not from trade to expiration.

Would anyone care to explain?

thanks

mike
-------
code segments from the example:
        // our option
        Option::Type type(Option::Put);
        Real underlying = 36;
        Real strike = 40;
        Spread dividendYield = 0.00;
        Rate riskFreeRate = 0.06;
        Volatility volatility = 0.20;

        Date todaysDate(15, May, 1998);
        Date settlementDate(17, May, 1998);
        Date exerciseDate(17, May, 1999);
        DayCounter rateDayCounter = Actual365();
        Time maturity = rateDayCounter.yearFraction(settlementDate,
                                                    exerciseDate);




Reply | Threaded
Open this post in threaded view
|

Re: question on AmericanOption.cpp

Luigi Ballabio
On 09/19/2005 08:48:59 PM, M L wrote:
> In the AmericanOption Class examples that come with the package, why  
> is the option calculated from settlementDate to exerciseDate? I  
> thought the value of the option was from trade date(todaysDate) to  
> expiration(15 May, 2005, not 17 May, 1998)? it seems like the example  
> is counting the days from settle to settle, not from trade to  
> expiration.

Probably an error. I'll look into it when I get a bit of time.

Later,
        Luigi


----------------------------------------

Better to have an approximate answer to the right question than a
precise answer to the wrong question.
--  John Tukey as quoted by John Chambers