mirror of
https://github.com/KeqingMoe/argparse.git
synced 2025-07-04 15:14:39 +00:00
Update README.md
This commit is contained in:
parent
347881f5b3
commit
c47f842c19
@ -174,11 +174,11 @@ program.add_argument("-c")
|
|||||||
.default_value(std::vector<float>{0.0f, 0.0f})
|
.default_value(std::vector<float>{0.0f, 0.0f})
|
||||||
.action([](const std::string& value) { return std::stof(value); });
|
.action([](const std::string& value) { return std::stof(value); });
|
||||||
|
|
||||||
program.parse_args(argc, argv);
|
program.parse_args(argc, argv); // Example: ./main -abc 1.95 2.47
|
||||||
|
|
||||||
auto a = program.get<bool>("-a");
|
auto a = program.get<bool>("-a"); // true
|
||||||
auto b = program.get<bool>("-b");
|
auto b = program.get<bool>("-b"); // true
|
||||||
auto c = program.get<std::vector<float>>("-c");
|
auto c = program.get<std::vector<float>>("-c"); // {1.95, 2.47}
|
||||||
|
|
||||||
/// Some code that prints parsed arguments
|
/// Some code that prints parsed arguments
|
||||||
```
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user