Vladimir Prus wrote:
On 10/08/2014 10:54 AM, Florian Lindner wrote:
Hello,
I have a couple of libraries (MPI, petsc) that also consume my applications argc and argv, which is parsed with boost::program_options before.
po seems to eat up argv, i.e. removes all items that it handles. Can I disable that behavior somehow so that po does not touch argc/argv. Or do I need to recreate it, e.g. using collect_unrecognized?
Florian,
this is not expected. Here's the code for parsing:
cmdline::cmdline(int argc, const char*const * argv) { #if defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS) vector<string> args; copy(argv+1, argv+argc+!argc, inserter(args, args.end())); init(args); #else init(vector<string>(argv+1, argv+argc+!argc)); #endif }
So the argc/argv is immediately converted into vector, which is parsed. Can you reproduce this problem in a simple example?
I'm sorry, that was my fault. Indeed it actually leaves argc intact. Best regards, Florian