From a133e9cc06ffeea8ad76338ad0421f1cd0f550ba Mon Sep 17 00:00:00 2001 From: Henry Fredrick Schreiner Date: Mon, 20 Nov 2017 16:24:22 -0500 Subject: [PATCH] Fixes for warnings --- include/CLI/App.hpp | 4 ++-- include/CLI/Option.hpp | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/CLI/App.hpp b/include/CLI/App.hpp index 4a9007d7..e139e2e5 100644 --- a/include/CLI/App.hpp +++ b/include/CLI/App.hpp @@ -285,7 +285,7 @@ class App { options_.emplace_back(); Option_p &option = options_.back(); option.reset(new Option(name, description, callback, defaulted, this)); - option->copy_from(option_defaults_); + option_defaults_.copy_to(option.get()); return option.get(); } else throw OptionAlreadyAdded(myopt.get_name()); @@ -895,7 +895,7 @@ class App { std::set subcmd_groups_seen; for(const App_p &com : subcommands_) { const std::string &group_key = detail::to_lower(com->get_group()); - if(group_key == "" || subcmd_groups_seen.count(group_key) != 0) + if(group_key.empty() || subcmd_groups_seen.count(group_key) != 0) continue; subcmd_groups_seen.insert(group_key); diff --git a/include/CLI/Option.hpp b/include/CLI/Option.hpp index b8f8b0d5..f7226ddb 100644 --- a/include/CLI/Option.hpp +++ b/include/CLI/Option.hpp @@ -42,11 +42,11 @@ template class OptionBase { /// Only take the last argument (requires `expected_ == 1`) bool last_{false}; - template void copy_from(const T &other) { - group_ = other.get_group(); - required_ = other.get_required(); - ignore_case_ = other.get_ignore_case(); - last_ = other.get_take_last(); + template void copy_to(T *other) const { + other->group(group_); + other->required(required_); + other->ignore_case(ignore_case_); + other->take_last(last_); } public: @@ -281,7 +281,7 @@ class Option : public OptionBase