Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2004-09-22 01:14:41


John Torjo wrote:

> I would suggest every formatter takes only one string which parses and
> finds all decorators itself.
> Each formatter will have one or more escape sequences which it uses to
> find the decorators.
>
>
> Something like:
>
> // in this case, '%' is used for identifying an element
> // '*' is to mean "leave default" (don't change)
>
> std::vector<int> v;
> // equivalent to your "[ ", ", ", " ]"
> std::cout << formatob(v, "[ %, % ]");
.......
> // for pair - you have "%1" and "%2"
> std::vector< std::pair<int,long> > vp;
> // 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?

- Volodya


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