Boost logo

Boost Users :

Subject: Re: [Boost-users] commandline args
From: OvermindDL1 (overminddl1_at_[hidden])
Date: 2009-08-24 00:28:01


On Sun, Aug 23, 2009 at 10:14 PM, Diederick C.
Niehorster<dcnieho_at_[hidden]> wrote:
> Oops, the situation is not as bad as i noted in my last message,
>
> bk::generate(ostream_iterator<char>(cout), "Command line options not
> recognized:\n" << ("  \"" << ba::string % ("\"" << bk::eol)) << "\""
> << bk::eol, vsUnrecog);
>
> Does almost what it should, except the prefix is only diplayed for the
> first item in the list (it thus doesn't seem to belong to the list.
>
> Output wanted:
> Options not recognized:
>  "dd"
>  "-e"
>  "rrty"
>
> Output got:
> Options not recognized:
>  "dd"
> -e"
> rrty"
>
> It seems unneccesarily complex though, and I have to put "\"" <<
> bk::eol in the code twice, is that really necessary?

Er, do this I mean (adding spacing to help clarify things for you to):
bk::generate(ostream_iterator<char>(cout),
  "Command line options not recognized:\n" <<
  (" \"" << ba::string << '\"') % bk::eol
  ,vsUnrecog);

To describe it, it first prints out a string, then the % operator has
two part, the left side ('\"' << ba::string << '\"'), and the right
bk::eol, meaning that the left side is run for each element in a list
separated by returns.


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