That's the question. Why would I use implicit_value over default_value and vice versa?
Thanks!
default_value()
is the value that will be put in the variables_map
if the user didn't specify another value:
./a.out # implies width=75 if that's the default_value for width ./a.out --width=80 # default_value not used
implicit_value()
is the value that will be used if the user specifies the option but without an adjacent value.
./a.out --width # implies width=75 if that's the implicit_value for width ./a.out --width=80 # implicit value not used
If you use implicit_value
then in commandline options's short options the user must specify the value immediately after the option:
./a.out -w80 # implicit_value not used ./a.out -w 80 # wrong: 80 parsed as extra arg if implicit_value is defined
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With