Boost logo

Boost :

From: Jonathan Graehl (jonathan_at_[hidden])
Date: 2004-10-21 15:42:24


Is it possible to index from option name to the original argv string(s)
supplied by the user?

It doesn't seem possible to do this with vm["option"].as<string>() since:

   1.

*template*<*typename* T> *const* T & as() *const*;

      If stored value if of type T, returns that value. Otherwise,
      throws boost::bad_any_cast exception.

Now that I think of it, because options can come from environment vars
and config files as well, the original string won't necessarily be lying
around in memory, but would have to be copied somewhere.

What would be nice is if variable_value could (yes, at some cost to
those who don't use it) store the original string(s) automatically?

The vector<option> from command_line_parser isn't convenient to use
(since it can't be indexed by option name, but would have to be searched.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk