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:
Sean Robinson 2021-11-10 13:54:33 -07:00
parent 6530a06747
commit abb2206141

View File

@ -453,7 +453,7 @@ public:
mUsedName = usedName;
if (mNumArgs == 0) {
mValues.emplace_back(mImplicitValue);
std::visit([](auto &aAction) { aAction({}); }, mAction);
std::visit([](const auto &aAction) { aAction({}); }, mAction);
return start;
} else if (mNumArgs <= std::distance(start, end)) {
if (auto expected = maybe_nargs()) {
@ -1049,7 +1049,7 @@ public:
// Printing the one and only help message
// I've stuck with a simple message format, nothing fancy.
[[deprecated("Use cout << program; instead. See also help().")]] std::string
print_help() {
print_help() const {
auto out = help();
std::cout << out.rdbuf();
return out.str();