c++ - FloatingRateBond cashflow retrieval and printing -
i using floatingratebond
class create floating rate bond object, have priced correctly. however, need retrieve cashflows , dirty price decompose yield. have been trying following without success:
leg cf=floatingratebond.cashflows(); leg::iterator it; for(it=cf.begin();it!=cf.end();++it) cout<<"type: "<<typeid(*it).name()<< " value:" << *it<<endl;
output:
type: n5boost10shared_ptrin8quantlib8cashfloweee value:0x14362a50 type: n5boost10shared_ptrin8quantlib8cashfloweee value:0x14362c40 type: n5boost10shared_ptrin8quantlib8cashfloweee value:0x14362e70 type: n5boost10shared_ptrin8quantlib8cashfloweee value:0x143630a0 type: n5boost10shared_ptrin8quantlib8cashfloweee value:0x143632d0 type: n5boost10shared_ptrin8quantlib8cashfloweee value:0x14363500 type: n5boost10shared_ptrin8quantlib8cashfloweee value:0x14363730 type: n5boost10shared_ptrin8quantlib8cashfloweee value:0x14363960 type: n5boost10shared_ptrin8quantlib8cashfloweee value:0x14363b90 type: n5boost10shared_ptrin8quantlib8cashfloweee value:0x14363dc0 type: n5boost10shared_ptrin8quantlib8cashfloweee value:0x14363ff0 type: n5boost10shared_ptrin8quantlib8cashfloweee value:0x14364220 type: n5boost10shared_ptrin8quantlib8cashfloweee value:0x14364450 type: n5boost10shared_ptrin8quantlib8cashfloweee value:0x14364680 type: n5boost10shared_ptrin8quantlib8cashfloweee value:0x143648b0 type: n5boost10shared_ptrin8quantlib8cashfloweee value:0x14364ae0 type: n5boost10shared_ptrin8quantlib8cashfloweee value:0x14364d10 type: n5boost10shared_ptrin8quantlib8cashfloweee value:0x14364f40 type: n5boost10shared_ptrin8quantlib8cashfloweee value:0x14365170 type: n5boost10shared_ptrin8quantlib8cashfloweee value:0x143653a0 type: n5boost10shared_ptrin8quantlib8cashfloweee value:0x14362660
thanks
your question not clear. you're trying iterate leg
, should defined as
typedef std::vector< boost::shared_ptr<cashflow> > leg;
source
so if it = cf.begin()
, *it
of type boost::shared_ptr<cashflow>
, explain type n5boost10shared_ptrin8quantlib8cashfloweee
, address 0x14365170
.
have tried de-referece 1 more time, cashflow
? problem?
Comments
Post a Comment