Image

Imagesynergetic wrote in Imagecpp 😯confused

Joy with boost::program_options

I've been playing around with various libraries to do C++ stuff gradually trying to replace C stuff in my code and the most recent thing to go under the hammer is getopt where I'm replacing it with the program_options part of boost.

Anyway, my query's quite specific. I've managed to get nearly everything to compile, but one thing is confusing me:

template<class charT>
basic_parsed_options<charT>
parse_config_file( std::basic_istream<charT>&, const options_description );

is a function that's part of boost and
options_description desc;
variable_map vm;
store( parse_config_file("example.cfg", desc), vm);

is how the boost doc says you're meant to use it. The crunch point is my compiler doesn't even look for the boost parse_config_file function because it's looking for (const char[16], options_description&) not the istream. So, how do I get this to work and why are the boost people even using an istream to pass a string to the function?

Very confusedly yours.