I have a boost::program_options option that successfully parses the desired input options into a vector, but I'm not seeing how to also give it a default value. Example:
base.add_options()
("vector_value",po::value<std::vector<double> >(&vecoption)->multitoken(),"description");
works fine to read values into vecoptions, and something like
base.add_options()
("int_value",po::value<int>(&intoption)->default_value(1),"description");
also works fine, but trying to give the vector argument a default value like in
base.add_options()
("vector_value",po::value<std::vector<double> >(&vecoption)->default_value(std::vector<double>{0,1,2}),"description");
gives a compiler error
error: static assertion failed: Source type is neither std::ostream`able nor std::wostream`able
How can I create a vector-valued float option with default values like {0,1,2}?
po::value
. Justpo::value(&intoption)
andpo::value(&vecoption)
are fine. It's a function template. – Jamestown