Re: 答复: C++ 11 Initializer lists features not supported in VS 2010/2012

Posted by Peter Caspers-4 on
URL: http://quantlib.414.s1.nabble.com/C-11-Initializer-lists-features-not-supported-in-VS-2010-2012-tp15609p15616.html

would that work then (starting at line 216) ?

        boost::shared_ptr<VanillaSwap>
        underlyingSwap(const boost::shared_ptr<SwapIndex> &index,
                       const Date &expiry, const Period &tenor) const {

            CachedSwapKey k = {index,expiry,tenor};
            CacheType::iterator i = swapCache_.find(k);
            if (i == swapCache_.end()) {
                boost::shared_ptr<VanillaSwap> underlying =
                    index->clone(tenor)->underlyingSwap(expiry);
                swapCache_.insert(std::make_pair(k, underlying));
                return underlying;
            }
            return i->second;
        }

best
Peter

On 18 July 2014 11:17, cheng li <[hidden email]> wrote:

> Hi Lugi and Peter,
>
> I compiled it with VS2012. The error message reads as, e.g.
> Error   97      error C2143: syntax error : missing ';' before '{' (ql\experimental\models\nonstandardswaption.cpp)     D:\dev\svn\CAL\quantlib\QuantLib\ql\experimental\models\gaussian1dmodel.hpp     225     1       QuantLib
>
> All these errors points line 220 and 225 in gaussian1dmodel.hpp.
>
> Regards,
> Cheng
>
> -----邮件原件-----
> 发件人: Luigi Ballabio [mailto:[hidden email]]
> 发送时间: 2014年7月18日 16:06
> 收件人: cheng li
> 抄送: Peter Caspers; QuantLib users
> 主题: Re: [Quantlib-users] C++ 11 Initializer lists features not supported in VS 2010/2012
>
> As in gaussiam1dmodel.hpp at line 220? As far as I see, that's struct initialization and it was in C++03 already, and even in C. (For instance, see the initialization of AmericanOptionData values[] in
> test-suite/americanoption.cpp.) In fact, g++ compiles it even with the
> -std=c++03 flag. But I seem to remember that it might or might not work depending on the compiler and types involved. Does it give you an error in VC++10/12?
>
> Luigi
>
>
> On Fri, Jul 18, 2014 at 4:21 AM, cheng li <[hidden email]> wrote:
>> Hi Peter,
>>
>>
>>
>> As I saw in the latest trunk, in the files, e.g. gaussian1dmodel.hpp,
>> initializer lists feature is used. As I tested this feature is not
>> supported in vs 2010/2012. So for backward compatibility, should we remove it?
>>
>>
>>
>> Regards,
>>
>> Cheng
>>
>>
>> ----------------------------------------------------------------------
>> -------- Want fast and easy access to all the code in your enterprise?
>> Index and search up to 200,000 lines of code with a free copy of Black
>> Duck Code Sight - the same software that powers the world's largest
>> code search on Ohloh, the Black Duck Open Hub! Try it now.
>> http://p.sf.net/sfu/bds
>> _______________________________________________
>> QuantLib-users mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>>
>
>
>
> --
> <https://implementingquantlib.blogspot.com>
> <https://twitter.com/lballabio>
>

------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users