From 268a6948c0400905dfc335427395519689f067f5 Mon Sep 17 00:00:00 2001 From: hop311 Date: Mon, 22 Jan 2024 20:02:58 +0000 Subject: Added reserve_more, expect_dictionary_key[s|_map]_reserve_length[_and_default] --- src/openvic-simulation/politics/Ideology.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/openvic-simulation/politics/Ideology.cpp') diff --git a/src/openvic-simulation/politics/Ideology.cpp b/src/openvic-simulation/politics/Ideology.cpp index 692b809..1848a0a 100644 --- a/src/openvic-simulation/politics/Ideology.cpp +++ b/src/openvic-simulation/politics/Ideology.cpp @@ -68,7 +68,8 @@ bool IdeologyManager::add_ideology( */ bool IdeologyManager::load_ideology_file(ast::NodeCPtr root) { size_t expected_ideologies = 0; - bool ret = expect_dictionary_reserve_length(ideology_groups, + bool ret = expect_dictionary_reserve_length( + ideology_groups, [this, &expected_ideologies](std::string_view key, ast::NodeCPtr value) -> bool { bool ret = expect_length(add_variable_callback(expected_ideologies))(value); ret &= add_ideology_group(key); @@ -77,7 +78,7 @@ bool IdeologyManager::load_ideology_file(ast::NodeCPtr root) { )(root); lock_ideology_groups(); - ideologies.reserve(ideologies.size() + expected_ideologies); + reserve_more_ideologies(expected_ideologies); ret &= expect_dictionary([this](std::string_view ideology_group_key, ast::NodeCPtr ideology_group_value) -> bool { IdeologyGroup const* ideology_group = get_ideology_group_by_identifier(ideology_group_key); -- cgit v1.2.3-56-ga3b1