mirror of
https://github.com/KeqingMoe/argparse.git
synced 2025-07-04 15:14:39 +00:00
Updated example to use std::string instead of cstring for default value
This commit is contained in:
parent
b8160a86b5
commit
af282c0f68
@ -748,7 +748,7 @@ files = {"a.txt", "b.txt", "c.txt"}
|
||||
argparse::ArgumentParser program("test");
|
||||
|
||||
program.add_argument("input")
|
||||
.default_value("baz")
|
||||
.default_value(std::string{"baz"})
|
||||
.action([](const std::string& value) {
|
||||
static const std::vector<std::string> choices = { "foo", "bar", "baz" };
|
||||
if (std::find(choices.begin(), choices.end(), value) != choices.end()) {
|
||||
|
Loading…
Reference in New Issue
Block a user