Skip to content

Commit

Permalink
fix: don't copy ConfigItems when iterating (#521)
Browse files Browse the repository at this point in the history
Use a const reference to avoid unnecessary copies. Also constify the
argument to _parse_config.
  • Loading branch information
alexdewar committed Oct 16, 2020
1 parent 438eabe commit 97e5ebe
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/CLI/App.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2390,8 +2390,8 @@ class App {
///
/// If this has more than one dot.separated.name, go into the subcommand matching it
/// Returns true if it managed to find the option, if false you'll need to remove the arg manually.
void _parse_config(std::vector<ConfigItem> &args) {
for(ConfigItem item : args) {
void _parse_config(const std::vector<ConfigItem> &args) {
for(const ConfigItem &item : args) {
if(!_parse_single_config(item) && allow_config_extras_ == config_extras_mode::error)
throw ConfigError::Extras(item.fullname());
}
Expand Down

0 comments on commit 97e5ebe

Please sign in to comment.