From 5aeb6f24df8785974010a36c63438609cf875f07 Mon Sep 17 00:00:00 2001 From: ToruNiina Date: Sun, 24 Dec 2017 10:42:45 +0900 Subject: [PATCH] change exception type #8; iterator may be invalid --- toml/parser.hpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/toml/parser.hpp b/toml/parser.hpp index 628498b..f470330 100644 --- a/toml/parser.hpp +++ b/toml/parser.hpp @@ -996,7 +996,7 @@ struct parse_data if(iter == std::prev(end)) { if(data.count(*iter) == 1) - throw std::make_pair(iter, syntax_error("duplicate key: " + *iter)); + throw syntax_error("duplicate key: " + *iter); data.emplace(*iter, std::move(v)); return; } @@ -1017,12 +1017,12 @@ struct parse_data auto& ar = data[*iter].template cast(); if(ar.empty()) ar.emplace_back(toml::Table{}); if(ar.back().type() != value_t::Table) - throw std::make_pair(iter, syntax_error("assign table into array having non-table type: " + *iter)); + throw syntax_error("assign table into array having non-table type: " + *iter); return push_table(ar.back().template cast(), std::move(v), std::next(iter), end); } else - throw std::make_pair(iter, syntax_error("assign table into not table: " + *iter)); + throw syntax_error("assign table into not table: " + *iter); } template().emplace_back(std::move(v)); return; @@ -1059,12 +1060,12 @@ struct parse_data auto& ar = data[*iter].template cast(); if(ar.empty()) ar.emplace_back(toml::Table{}); if(ar.back().type() != value_t::Table) - throw std::make_pair(iter, syntax_error("assign table into array having non-table type: " + *iter)); + throw syntax_error("assign table into array having non-table type: " + *iter); return push_array_of_table(ar.back().template cast(), std::move(v), std::next(iter), end); } else - throw std::make_pair(iter, syntax_error("assign array of table into not table: " + *iter)); + throw syntax_error("assign array of table into not table: " + *iter); } };