Changed from using std::set to std::vector for mutex_args elements

This commit is contained in:
Pranav Srinivas Kumar 2023-11-04 15:51:22 -05:00
parent ecccae530c
commit a9869150fd

View File

@ -46,7 +46,6 @@ SOFTWARE.
#include <map> #include <map>
#include <numeric> #include <numeric>
#include <optional> #include <optional>
#include <set>
#include <sstream> #include <sstream>
#include <stdexcept> #include <stdexcept>
#include <string> #include <string>
@ -1429,7 +1428,7 @@ public:
// argument_it = other.m_argument_map.find("name") // argument_it = other.m_argument_map.find("name")
auto first_name = arg->m_names[0]; auto first_name = arg->m_names[0];
auto it = m_argument_map.find(first_name); auto it = m_argument_map.find(first_name);
group.m_elements.insert(&(*it->second)); group.m_elements.push_back(&(*it->second));
} }
m_mutually_exclusive_groups.push_back(std::move(group)); m_mutually_exclusive_groups.push_back(std::move(group));
} }
@ -1492,14 +1491,14 @@ public:
template <typename... Targs> Argument &add_argument(Targs... f_args) { template <typename... Targs> Argument &add_argument(Targs... f_args) {
auto &argument = m_parent.add_argument(std::forward<Targs>(f_args)...); auto &argument = m_parent.add_argument(std::forward<Targs>(f_args)...);
m_elements.insert(&argument); m_elements.push_back(&argument);
return argument; return argument;
} }
private: private:
ArgumentParser &m_parent; ArgumentParser &m_parent;
bool m_required{false}; bool m_required{false};
std::set<Argument *> m_elements{}; std::vector<Argument *> m_elements{};
}; };
MutuallyExclusiveGroup &add_mutually_exclusive_group(bool required = false) { MutuallyExclusiveGroup &add_mutually_exclusive_group(bool required = false) {