$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [Boost-users] [program_options] Obtaining parameter order
From: Vladimir Prus (vladimir_at_[hidden])
Date: 2009-04-13 12:19:20
Adam Nielsen wrote:
>>> For example, a program to work with .zip files might work like this:
>>>
>>>  zip --rename=one.bin:alpha.bin --add=one.bin --rename=one.bin:beta.bin
>> 
>> The parse_command_line function returns vector<options> which is accurate
>> representation of what was found on the command line -- in particular:
>> 
>> - the order of options is the same as on command line
>> - if there are multiple occurrences of the same option, those are not
>> collapsed and stay separate.
>> 
>> Does this help?
> 
> Yes!  This works exactly as I need.  Thanks!
> 
> One question - parse_command_line() returns (eventually) a vector of
> basic_option.  This basic_option class contains the name of the option and a
> vector of values.
> 
> What is this vector used for?  If a command line option has no value (e.g.
> "--verbose") then the vector is of course empty, and if the command line
> option has a value (such as "--output file.bin") then the vector contains a
> single value, so I'm wondering whether there's some syntax that will cause
> multiple values to end up in this vector, or is it there for use later on
> (when options are combined)?
You can declare an option that takes multiple values, so
        --such-an-option a b c --another-option
will result in a vector of values containing 'a', 'b', and 'c'. 
- Volodya