|
Boost Users : |
From: Vladimir Prus (ghost_at_[hidden])
Date: 2006-04-24 04:52:17
Nathan LeZotte wrote:
> I believe this functionality is built right in to the program_options
> library if you use value< vector<T> > as your value semantic. There
> is an example of this in the "Getting Started" section of the
> program_options documentation
> (http://www.boost.org/doc/html/program_options/tutorial.html). Here
> is a small snippet of what's in the docs:
>
> int opt;
> po::options_description desc("Allowed options");
> desc.add_options()
> ("help", "produce help message")
> ("optimization", po::value<int>(&opt)->default_value(10),
> "optimization level")
> ("include-path,I", po::value< vector<string> >(),
> "include path")
> ("input-file", po::value< vector<string> >(), "input file")
> ;
>
> The tutorial section in the docs isn't 100% clear about what this
> does, but I'm pretty sure if you have a command-line with (for
> example) multiple --include-path options, then push_back is called on
> a vector in the variables_map for each instance of the --include-path
> option.
Hi Nathan,
I've just clarified the tutorial to say that std::vector values
automatically allow multiple occurences of options.
Thanks,
Volodya
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