65 {
66
67
68
69
70 std::set<std::tuple<Size, Date, std::string, std::string, Size>>
dates;
71 for (Size i = 0; i <
slots_.size(); ++i) {
73 }
74
75
76
77 std::vector<Date> resultDates;
78 std::vector<std::string> resultCurrencies;
79 std::vector<Size> resultLegNos;
80 std::vector<std::string> resultCashflowTypes;
81 std::vector<RandomVariable> resultAmounts;
82 Date lastDate = Null<Date>();
83 std::string lastCurrency;
84 Size lastLegNo = Null<Size>();
85 std::string lastCashflowType;
86 for (
auto const& d :
dates) {
87 if (std::get<1>(d) == lastDate && std::get<2>(d) == lastCurrency && std::get<0>(d) == lastLegNo &&
88 std::get<3>(d) == lastCashflowType)
89 resultAmounts.back() +=
amounts_[std::get<4>(d)];
90 else {
91 resultAmounts.push_back(
amounts_[std::get<4>(d)]);
92 resultDates.push_back(std::get<1>(d));
93 resultCurrencies.push_back(std::get<2>(d));
94 resultLegNos.push_back(std::get<0>(d));
95 resultCashflowTypes.push_back(std::get<3>(d));
96 }
97 lastDate = std::get<1>(d);
98 lastCurrency = std::get<2>(d);
99 lastLegNo = std::get<0>(d);
100 lastCashflowType = std::get<3>(d);
101 }
102
103
104
105 amounts_ = std::move(resultAmounts);
106 dates_ = std::move(resultDates);
108 legNos_ = std::move(resultLegNos);
110
111
112
114}
const std::vector< Date > & dates() const