Tiens, ça fait longtemps que je voulais trouver quelque chose de plus facile à utiliser que boost:rogram_options. Je l'aime bien, mais c'est bien trop verbeux.
Je me demandais si ça valait le coup de simplifier par métaprogrammation les codes que j'utilisais, mais visiblement y'a quelqu'un qui l'a fait pour moi
https://github.com/matt-42/iod/blob/...ommand_line.cc
Code:
const char* argv[] = {"", "--opt1", "0", "-abc", "-d=0"};
auto opts = parse_command_line(4, argv,
_opt1 = bool(),
_a = bool(),
_b = bool(),
_c = bool(),
_d = bool());
assert(opts.opt1 == false and
opts.a == true and
opts.b == true and
opts.c == true and
opts.d == false);