Skip to content

Commit cd7dae2

Browse files
committed
Fix getters to constref return
1 parent de76983 commit cd7dae2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

include/CLI/Option.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ class Option : public OptionBase<Option> {
418418
}
419419

420420
/// Adds a Validator. Takes a const string& and returns an error message (empty if conversion/check is okay).
421-
Option *check(const std::function<std::string(const std::string &)> &Validator,
421+
Option *check(std::function<std::string(const std::string &)> Validator,
422422
std::string Validator_description = "",
423423
std::string Validator_name = "") {
424424
validators_.emplace_back(Validator, std::move(Validator_description), std::move(Validator_name));
@@ -663,10 +663,10 @@ class Option : public OptionBase<Option> {
663663
callback_t get_callback() const { return callback_; }
664664

665665
/// Get the long names
666-
std::vector<std::string> get_lnames() const { return lnames_; }
666+
const std::vector<std::string> &get_lnames() const { return lnames_; }
667667

668668
/// Get the short names
669-
std::vector<std::string> get_snames() const { return snames_; }
669+
const std::vector<std::string> &get_snames() const { return snames_; }
670670

671671
/// Get the flag names with specified default values
672672
std::vector<std::string> get_fnames() const { return fnames_; }

0 commit comments

Comments
 (0)