Ticket #12535: program_options_uint8_demo.cc
File program_options_uint8_demo.cc, 375 bytes (added by , 5 years ago) |
---|
Line | |
---|---|
1 | #include <cassert> |
2 | #include <boost/program_options.hpp> |
3 | |
4 | int |
5 | main() |
6 | { |
7 | using namespace boost::program_options; |
8 | options_description desc("Options"); |
9 | std::uint8_t num = 0; |
10 | desc.add_options() |
11 | ("num", value(&num)) |
12 | ; |
13 | |
14 | variables_map vm; |
15 | const char *const args[] = { "prog", "--num=241" }; |
16 | store(parse_command_line(2, args, desc), vm); |
17 | notify(vm); |
18 | assert(num == 241); |
19 | } |