Boost logo

Boost :

From: Rob Stewart (stewart_at_[hidden])
Date: 2004-09-22 10:34:02


From: John Torjo <john.lists_at_[hidden]>
> Vladimir Prus wrote:
> > John Torjo wrote:
> >
> >>// write XML
> >>std::cout << formatob(vp,
> >> containerfmt("<elem> % </elem><elem> % </elem>",
> >
> > And how do you know what to output if there's only one element?
>
> Basically this is just a simper interface for the user.
> The decorator will parse the string, which in the above case means:
>
> - open: "<elem> "
> - seq : " </elem><elem> "
> - close: " </elem>"

BTW, that parsing can be to simply replace "%" with \0 and
tracking the pointers to the start of each piece. Thus, no
copying is needed.

> But to the human eye, it's much easier to understand:
> "<elem> % </elem><elem> % </elem>"
>
> than
> "<elem> "," </elem><elem> "," </elem>"

Agreed, but pipes ("|") are easier to grok:

  "<elem> | </elem><elem> | </elem>"

-- 
Rob Stewart                           stewart_at_[hidden]
Software Engineer                     http://www.sig.com
Susquehanna International Group, LLP  using std::disclaimer;

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk