For the above reasons, the the library is designed so that it can be easily used as shared library, with minimum code on the side of main application. In particular, templates are used only where necessary, for example for validation of user-defined types. In other places, boost::function is used to allow customization, but keep templates out of the public interface.
Such interface appears to be much more usable. If we were using enumeration for different properties of parameter, there would be another argument to many functions, the need to type long, possible qualified names, and little advantage.
That little advantage is that if you type a wrong enumeration name, you'd get a compile error. If you type '!' instead of '?' after parameter name, you'd get incorrect behaviour. However, such errors are deemed rare.
desc.add_options()
("verbose", "", "verbosity level")
("magic", "int", "magic value").notify(some_func)
;
Another possibility would be:
option_description d1(...), d2(...);
desc.add(d1 & d2);
option_description d1(...), d2(...);
desc = d1, d2;
The drawback is the need to explicitly create new objects and give names to them. The latter problem can be helped if objects are created inside expressions:
desc = option_description(...), option_description(...)
--help on command line results in throwing an exception. Actually, the "special" option must have been configurable. This was not implemeneted, because applications might reasonable want to process the rest of command line even of --help was seen. For example, --verbose option can control how much help should be output, or there may be several subcommand with different help screens.