mirror of
https://github.com/CLIUtils/CLI11.git
synced 2025-05-02 21:53:51 +00:00
fix: don't copy ConfigItems when iterating (#521)
Use a const reference to avoid unnecessary copies. Also constify the argument to _parse_config.
This commit is contained in:
parent
438eabe5f8
commit
97e5ebe490
@ -2390,8 +2390,8 @@ class App {
|
|||||||
///
|
///
|
||||||
/// If this has more than one dot.separated.name, go into the subcommand matching it
|
/// 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.
|
/// 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) {
|
void _parse_config(const std::vector<ConfigItem> &args) {
|
||||||
for(ConfigItem item : args) {
|
for(const ConfigItem &item : args) {
|
||||||
if(!_parse_single_config(item) && allow_config_extras_ == config_extras_mode::error)
|
if(!_parse_single_config(item) && allow_config_extras_ == config_extras_mode::error)
|
||||||
throw ConfigError::Extras(item.fullname());
|
throw ConfigError::Extras(item.fullname());
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user