|
Boost Users : |
Subject: Re: [Boost-users] commandline args
From: Diederick C. Niehorster (dcnieho_at_[hidden])
Date: 2009-08-24 02:53:34
Ha! cool, thanks again. I'll have to delve into this some more when i
need it more. I can see how these functions can also provide very nice
ways of writing numeric vectors to file.
Things will get slightly more complicated for some other usage cases i
have, so i'll have to read up on that. I'll post back when I can
figure it out. One of them is a matrix (class written by my
colleague), i guess i could loop over the rows and then throw the
vector into the generator, or would there be more efficient
ways/tricks?
Best,
Diederick
On Mon, Aug 24, 2009 at 2:17 PM, OvermindDL1<overminddl1_at_[hidden]> wrote:
> On Sun, Aug 23, 2009 at 11:58 PM, Diederick C.
> Niehorster<dcnieho_at_[hidden]> wrote:
>> Yup, now it works.
>>
>> For reference, I got rid of the duplicated bk::eol also by using the
>> folloing code:
>>
>> bk::generate(ostream_iterator<char>(cout),
>> Â Â Â Â "Command line options not recognized:\n" <<
>> Â Â Â Â (" Â \"" << ba::string << '"' << bk::eol) % "",
>> Â Â Â Â vsTest);
>>
>> Not putting an empty char array after the modulus operator would be
>> invalid C++ and is thus required.
>
> Why not just use what I posted? Â There-for you will not have a
> trailing eol, if you want a trailing eol then you should just loop it,
> not list it, do this:
> bk::generate(ostream_iterator<char>(cout),
> Â Â Â "Command line options not recognized:\n" <<
> Â Â Â +(" Â \"" << ba::string << '"' << bk::eol),
> Â Â Â vsTest);
>
> The + in front of that loop section means 1 or more, you can also use
> * for zero or more, but since you should be testing you array size
> before you call this anyway, you know you have at least one, you can
> also not do an array size test outside of it and do it inside the
> parsing function but there is not much point here it is so simple. Â :)
> _______________________________________________
> 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