mirror of
https://github.com/KeqingMoe/argparse.git
synced 2025-07-04 15:14:39 +00:00
Initialize mNames using
This commit is contained in:
parent
d9bff3dc2b
commit
328f1048da
@ -90,7 +90,7 @@ public:
|
|||||||
Argument() = default;
|
Argument() = default;
|
||||||
|
|
||||||
template <typename ...Args>
|
template <typename ...Args>
|
||||||
Argument(Args... args)
|
explicit Argument(Args... args)
|
||||||
: mNames({std::move(args)...})
|
: mNames({std::move(args)...})
|
||||||
, mIsOptional((is_optional(args) || ...))
|
, mIsOptional((is_optional(args) || ...))
|
||||||
{}
|
{}
|
||||||
@ -301,7 +301,7 @@ class ArgumentParser {
|
|||||||
// Call add_argument with variadic number of string arguments
|
// Call add_argument with variadic number of string arguments
|
||||||
template<typename... Targs>
|
template<typename... Targs>
|
||||||
Argument& add_argument(Targs... Fargs) {
|
Argument& add_argument(Targs... Fargs) {
|
||||||
std::shared_ptr<Argument> tArgument = std::make_shared<Argument>(Fargs...);
|
std::shared_ptr<Argument> tArgument = std::make_shared<Argument>(std::move(Fargs)...);
|
||||||
|
|
||||||
if (!tArgument->mIsOptional)
|
if (!tArgument->mIsOptional)
|
||||||
mPositionalArguments.push_back(tArgument);
|
mPositionalArguments.push_back(tArgument);
|
||||||
|
Loading…
Reference in New Issue
Block a user