Boost logo

Boost :

From: Neal D. Becker (nbecker_at_[hidden])
Date: 2003-04-30 08:56:45

I'm trying to learn to use program options, posted here by Vladimir Prus.

I was trying to use the variables map, and I wanted a "double" variable. It
seems validator is specialized for float, but not double.

I tried following the example of the float type:
namespace boost { namespace program_options {
  void validator<double>::operator()(any& v, const vector<string>& xs)
    string s(get_single_string(xs));
    try {
      v = any(lexical_cast<double>(s));
    catch(bad_lexical_cast&) {
      throw validation_error("'" + s + "' doesn't look like a double value.");

But check_first_occurence and get_single_string are in an anonymous namespace,
and are not accessible.

Is there a workaround? Should these functions be moved to a different
namespace to make extension more convenient?

Boost list run by bdawes at, gregod at, cpdaniel at, john at