boost::program_options syntax questions

P

pallav

i'm using the boost:rogram_options and i'm having some problems with
syntax: the code in question is the following:

vector<string> opt;
po:ptions_description desc("Usage");
desc.add_options()
("nodes,n", po::value<vector<string> > (&opt)->default_value("*"),
"Name of node(s) to print.")
;

/usr/local/include/boost-1_33_1/boost/program_options/
value_semantic.hpp:152: note: candidates are:
boost:rogram_options::typed_value<T, charT>*
boost:rogram_options::typed_value<T, charT>::default_value(const T&)
[with T = std::vector<std::string, std::allocator<std::string> >,
charT = char]

basically i want to assign the "nodes,n" option a default value of "*"
but i'm not sure what the correct syntax is. i'm trying (&opt)-
default_value("*") but this works if it were a string. i.e. like
this:

string opt;
desc.add_options()
("nodes,n" po::value<sring> (&opt)->default_value("some string"),
"Names of node(s) to print")

what about if i want to make opt a vector<string>? any ideas will be
appreciated.
thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top