|
Boost Users : |
Subject: [Boost-users] Program options: Set function for an option?
From: Ingo Maindorfer (ingo_at_[hidden])
Date: 2010-08-17 05:43:59
Hi!
Let's assume we have this: (stolen from tutorial):
// Declare the supported options.
po::options_description desc("Allowed options");
desc.add_options()
("compression", po::value<int>(), "set compression level")
;
po::variables_map vm;
po::store(po::parse_command_line(ac, av, desc), vm);
po::notify(vm);
...
if (vm.count("compression")) {
cout << "Compression level was set to "
<< vm["compression"].as<int>() << ".\n";
} else {
cout << "Compression level was not set.\n";
}
Is there a way to set a new int to "compression" programmatically like this:
vm["compression"].set( 42 ) ?
Best regards,
Ingo
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