Boost logo

Boost Users :

Subject: [Boost-users] program_options and value<T>
From: Zachary Turner (divisortheory_at_[hidden])
Date: 2009-06-22 18:47:52


I want to extend the program_options to support parsing of value types
that are not supported by default. For example, parsing of enum
types. Suppose I have an enum

typedef enum {
   ValueA,
   ValueB,
   ValueC
} TestEnum;

as well as some other enums.

What I'd like to do is something like this:

options_description options;
variables_map variables;

options.add_options()
   ("test", value<TestEnum>(), "test")
   ("test2", value<TestEnum2>(), "test2");

etc.

So that on the command line I can specify something along the lines of

foo.exe --test=ValueA --test2=ValueAA

and it will automatically convert them appropriately.

Anyone can point me in the direction?


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net