Migrate to C++17. Update sol2 to 3.3.0. (#6279)

* Migrate to C++17. Update sol2 to 3.3.0.
This commit is contained in:
Siarhei Fedartsou
2022-07-31 01:56:17 +02:00
committed by GitHub
parent 204fdaff6e
commit 4e8ee288d9
413 changed files with 30288 additions and 386664 deletions
+12 -20
View File
@@ -965,14 +965,10 @@ Sol2ScriptingEnvironment::GetStringListFromTable(const std::string &table_name)
auto &context = GetSol2Context();
BOOST_ASSERT(context.state.lua_state() != nullptr);
std::vector<std::string> strings;
if (!context.profile_table[table_name])
sol::optional<sol::table> table = context.profile_table[table_name];
if (table && table->valid())
{
return strings;
}
sol::table table = context.profile_table[table_name];
if (table.valid())
{
for (auto &&pair : table)
for (auto &&pair : *table)
{
strings.emplace_back(GetSetOrSequenceValue(pair));
}
@@ -987,17 +983,13 @@ Sol2ScriptingEnvironment::GetStringListsFromTable(const std::string &table_name)
auto &context = GetSol2Context();
BOOST_ASSERT(context.state.lua_state() != nullptr);
if (!context.profile_table[table_name])
{
return string_lists;
}
sol::table table = context.profile_table[table_name];
if (!table.valid())
sol::optional<sol::table> table = context.profile_table[table_name];
if (!table || !table->valid())
{
return string_lists;
}
for (const auto &pair : table)
for (const auto &pair : *table)
{
sol::table inner_table = pair.second;
if (!inner_table.valid())
@@ -1191,14 +1183,14 @@ void LuaScriptingContext::ProcessNode(const osmium::Node &node,
{
case 4:
case 3:
node_function(profile_table, node, result, relations);
node_function(profile_table, std::cref(node), result, relations);
break;
case 2:
node_function(profile_table, node, result);
node_function(profile_table, std::cref(node), result);
break;
case 1:
case 0:
node_function(node, result);
node_function(std::cref(node), result);
break;
}
}
@@ -1213,14 +1205,14 @@ void LuaScriptingContext::ProcessWay(const osmium::Way &way,
{
case 4:
case 3:
way_function(profile_table, way, result, relations);
way_function(profile_table, std::cref(way), std::ref(result), std::cref(relations));
break;
case 2:
way_function(profile_table, way, result);
way_function(profile_table, std::cref(way), std::ref(result));
break;
case 1:
case 0:
way_function(way, result);
way_function(std::cref(way), std::ref(result));
break;
}
}