Boost logo

Boost Users :

Subject: Re: [Boost-users] [program options] parsing std::string
From: Dmitriy Matison (matison.d_at_[hidden])
Date: 2013-05-30 04:49:46


Hello Michael:

If you want no positional options to be allowed you can refer to this
answer:
http://stackoverflow.com/questions/3858251/parsing-positional-arguments/3859400#3859400

To parse a multi-token value correctly you should call special member
function of a PO option.
PO option is of type boost::program_options::typed_value<T>, it has a
member function multitoken().
multitoken() should be called before adding an option to PO set of
functions. Value type should be std::vector<T> then.

Regards,
Dmitriy Matison.

On 29 May 2013 14:24, Michael Powell <mwpowellhtx_at_[hidden]> wrote:

> Hello,
>
> I want to parse std::string, perhaps into a vector<string>, but I do
> not want the command line argument to be positional in nature (i.e.
> like the examples demonstrate), because there may be a handful of
> parameters I need to capture into string or vector<string>.
>
> I've been able to parse integral types like int, even vector<int>, but
> haven't had much success with string. Possible or is this a program
> options "feature" and/or bug?
>
> Regards,
>
> Michael Powell
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net