Skip to content

Commit 175916c

Browse files
committed
multimap::equa_range : エラー処理を追加
1 parent dee2ab3 commit 175916c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

reference/map/multimap/equal_range.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ int main()
5858
5959
using iterator = decltype(m)::iterator;
6060
std::pair<iterator, iterator> ret = m.equal_range("B");
61+
if (ret.first == m.end()) {
62+
std::cout << "not found" << std::endl;
63+
return 1;
64+
}
6165
6266
for (iterator it = ret.first; it != ret.second; ++it) {
6367
std::cout << it->first << "," << it->second << std::endl;

0 commit comments

Comments
 (0)