You 're welcome Ziegele,
1) No, because CashFlow is abstract and emplace_back relies on the existence of a constructor.
2) I am not familiar with the visitor pattern, but I suspect you could achieve this by removing all the visit overloads except the void visit( CashFlow & c ) one.
Then you modify the code inside as follows:
void visit( CashFlow & c ) {
cashFlowSum += p->amount();if( SimpleCashFlow * p = dynamic_cast<CashFlow *>( &c ) ) {
simpleCashFlowSum += p->amount();}
else if( Redemption * p = dynamic_cast<Redemption *>( &c ) ) {
redemptionSum += p->amount();}
else if( AmortizingPayment * p = dynamic_cast<AmortizingPayment *>( &c ) ) {
amortizingPaymentSum += p->amount();}
}
Let me know if this works
Cheers
Yannis
------------------------------------------------------------------------------On 26.01.2017 20:42, ziegele wrote:
Thanks Yannis! 1 last question: is there a way to emplace_back a CashFlow shared_ptr? It shows that it's purely virtual, which only serves as an interface: <http://quantlib.10058.n7.nabble.com/file/n18024/cashFlow.jpg> Is there anyway of generating a non-zero report for "all other cash flows" part? <http://quantlib.10058.n7.nabble.com/file/n18024/output.jpg> Thanks, ziegele -- View this message in context: http://quantlib.10058.n7.nabble.com/Error-in-compiling-of-QuantLib-examples-tp17991p18024.html Sent from the quantlib-users mailing list archive at Nabble.com. ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Free forum by Nabble | Disable Popup Ads | Edit this page |