Skip to content

Commit e5733c4

Browse files
committed
iterate bimap correctly
1 parent 850af05 commit e5733c4

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

ql/time/ecb.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -269,17 +269,18 @@ namespace QuantLib {
269269
ecbCode << " is not a valid ECB code");
270270

271271
const boost::string_view month(ecbCode.data(), 3);
272-
auto itMonth = MONTHS.left.find(month);
272+
const Month monthEnum = MONTHS.left.at(month);
273273

274274
string nextCodeStr;
275275
nextCodeStr.reserve(5);
276-
if (itMonth->first != "DEC") {
276+
if (monthEnum != December) {
277277
// use next month
278-
const boost::string_view nextMonth = (++itMonth)->first;
278+
const Month nextMonthEnum = static_cast<Month>(monthEnum + 1);
279+
const boost::string_view nextMonth = MONTHS.right.at(nextMonthEnum);
279280
nextCodeStr.append(nextMonth.data(), 3);
280281

281282
// copy year
282-
nextCodeStr += { ecbCode[3], ecbCode[4] };
283+
nextCodeStr += {ecbCode[3], ecbCode[4]};
283284
} else {
284285
// previous month was DEC
285286
nextCodeStr.append("JAN");

0 commit comments

Comments
 (0)