From: Neal D. Becker (ndbecker2_at_[hidden])
Date: 2004-06-10 14:11:27


Seems natural to use boost::optional with program_options. Has anyone tried
this?

For example, consider this:

int main (int argc, char** argv) {
  namespace po = boost::program_options;

  optional<double> x;

  po::options_description desc("Allowed options");
  desc.add_options()
    ("help", "produce help message")
    ("x", po::value<double>()->notifier (var(x)=_1))
    ;

To set the optional<double> x, this uses boost::lambda. Is there a more
direct approach?