mirror of
https://github.com/KeqingMoe/argparse.git
synced 2025-07-04 07:04:39 +00:00
Declare lambda parameter and ArgumentParser::print_help as const
These were respectively reported as constParameter and functionConst style issues by cppcheck. Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
This commit is contained in:
parent
6530a06747
commit
abb2206141
@ -453,7 +453,7 @@ public:
|
|||||||
mUsedName = usedName;
|
mUsedName = usedName;
|
||||||
if (mNumArgs == 0) {
|
if (mNumArgs == 0) {
|
||||||
mValues.emplace_back(mImplicitValue);
|
mValues.emplace_back(mImplicitValue);
|
||||||
std::visit([](auto &aAction) { aAction({}); }, mAction);
|
std::visit([](const auto &aAction) { aAction({}); }, mAction);
|
||||||
return start;
|
return start;
|
||||||
} else if (mNumArgs <= std::distance(start, end)) {
|
} else if (mNumArgs <= std::distance(start, end)) {
|
||||||
if (auto expected = maybe_nargs()) {
|
if (auto expected = maybe_nargs()) {
|
||||||
@ -1049,7 +1049,7 @@ public:
|
|||||||
// Printing the one and only help message
|
// Printing the one and only help message
|
||||||
// I've stuck with a simple message format, nothing fancy.
|
// I've stuck with a simple message format, nothing fancy.
|
||||||
[[deprecated("Use cout << program; instead. See also help().")]] std::string
|
[[deprecated("Use cout << program; instead. See also help().")]] std::string
|
||||||
print_help() {
|
print_help() const {
|
||||||
auto out = help();
|
auto out = help();
|
||||||
std::cout << out.rdbuf();
|
std::cout << out.rdbuf();
|
||||||
return out.str();
|
return out.str();
|
||||||
|
Loading…
Reference in New Issue
Block a user