Boost logo

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


Let's assume we have this: (stolen from tutorial):

// Declare the supported options.
po::options_description desc("Allowed options");
     ("compression", po::value<int>(), "set compression level")

po::variables_map vm;
po::store(po::parse_command_line(ac, av, desc), 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,


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at