From abb220614129fb96fbf53308d2150dbf8016dddf Mon Sep 17 00:00:00 2001 From: Sean Robinson Date: Wed, 10 Nov 2021 13:54:33 -0700 Subject: [PATCH] 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 --- include/argparse/argparse.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/argparse/argparse.hpp b/include/argparse/argparse.hpp index ab3c564..34dab79 100644 --- a/include/argparse/argparse.hpp +++ b/include/argparse/argparse.hpp @@ -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();