Re: [Boost-bugs] [Boost C++ Libraries] #1132: zero_tokens doesn't work

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #1132: zero_tokens doesn't work
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-11-05 09:23:30

#1132: zero_tokens doesn't work
 Reporter: Bryan Green <bgreen0@…> | Owner: vladimir_prus
     Type: Bugs | Status: new
Milestone: Boost 1.36.0 | Component: program_options
  Version: Boost 1.34.1 | Severity: Problem
 Keywords: |

Comment(by vladimir_prus):

 Another way how zero_tokens is used to good effect is the 'bool_switch'

     BOOST_PROGRAM_OPTIONS_DECL typed_value<bool>*
     bool_switch(bool* v)
         typed_value<bool>* r = new typed_value<bool>(v);

         return r;

 This, together with validator for the bool types, allows to make
 --whatever be interpreted as 'true' value for 'whatever' option. Note this

     BOOST_PROGRAM_OPTIONS_DECL void validate(any& v, const vector<string>&
                        bool*, int)
         string s(get_single_string(xs, true));

 The 'true' passed to 'get_single_string' means that if there are no
 tokens, the empty string should be returned -- which is then interpreted
 as true value.

 Therefore, 'zero_tokens' makes sense exclusively when the validator for
 the type handles empty string or 'implied_value' is also specified. Seems
 like purely documentation bug to me, then.

Ticket URL: <>
Boost C++ Libraries <>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:01 UTC