Slightly improve code.

This commit is contained in:
King_DuckZ 2020-04-02 02:28:30 +02:00
parent 4958a83ddb
commit 329ccef6ef

View file

@ -259,7 +259,6 @@ namespace duck { namespace sl {
template <typename T>
std::size_t operator()(const T&) const { return 1; }
std::size_t operator()(const mstch::array& parItem) const { return parItem.size(); }
std::size_t operator()(const std::vector<std::string>& parItem) const { return parItem.size(); }
};
class ArraysToStructArrayVisitor : public boost::static_visitor<> {
@ -277,13 +276,6 @@ namespace duck { namespace sl {
}
}
void operator()(const std::string& parName, const std::vector<std::string>& parItem) {
for (std::size_t z = 0; z < parItem.size(); ++z) {
auto& curr_map = boost::get<mstch::map>(m_array[z]);
curr_map[parName] = parItem[z];
}
}
template <typename T>
void operator()(const std::string& parName, const T& parItem) {
auto& curr_map = boost::get<mstch::map>(m_array[0]);
@ -404,7 +396,7 @@ namespace duck { namespace sl {
boost::apply_visitor(visitor, itm.second);
}
parOut[std::string(curr_struct.name)] = std::move(fix_visitor.steal_struct());
parOut[std::string(curr_struct.name)] = fix_visitor.steal_struct();
}
}