mirror of
https://github.com/KeqingMoe/argparse.git
synced 2025-07-03 14:44:40 +00:00
Replace vector::operator[] use with vector::front
This is mostly a style change to match other parts of the code. Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
This commit is contained in:
parent
2a15178bb7
commit
50e3afd81d
@ -597,7 +597,7 @@ public:
|
||||
std::string get_inline_usage() const {
|
||||
std::stringstream usage;
|
||||
// Find the longest variant to show in the usage string
|
||||
std::string longest_name = m_names[0];
|
||||
std::string longest_name = m_names.front();
|
||||
for (const auto &s : m_names) {
|
||||
if (s.size() > longest_name.size()) {
|
||||
longest_name = s;
|
||||
@ -775,7 +775,7 @@ private:
|
||||
|
||||
void throw_required_arg_not_used_error() const {
|
||||
std::stringstream stream;
|
||||
stream << m_names[0] << ": required.";
|
||||
stream << m_names.front() << ": required.";
|
||||
throw std::runtime_error(stream.str());
|
||||
}
|
||||
|
||||
@ -1343,9 +1343,9 @@ public:
|
||||
|
||||
// Add any options inline here
|
||||
for (const auto &argument : this->m_optional_arguments) {
|
||||
if (argument.m_names[0] == "-v") {
|
||||
if (argument.m_names.front() == "-v") {
|
||||
continue;
|
||||
} else if (argument.m_names[0] == "-h") {
|
||||
} else if (argument.m_names.front() == "-h") {
|
||||
stream << " [-h]";
|
||||
} else {
|
||||
stream << " " << argument.get_inline_usage();
|
||||
|
Loading…
Reference in New Issue
Block a user