ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> boost
boost
[boost] program options - how to extend
by Neal D. Becker other posts by this author
Apr 30 2003 1:56PM messages near this date
[boost] Re: ATTN: All Developers Interested in Boost.Preprocessor | Re: [boost] program options - how to extend
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 {
  template<> 
  void validator<double> ::operator()(any& v, const vector<string>& xs)
  {
    check_first_occurence(v);
    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?
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Thread:
Neal D. Becker
Vladimir Prus
Neal D. Becker
Vladimir Prus

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved