Boost logo

Boost :

From: Stewart, Robert (stewart_at_[hidden])
Date: 2002-01-29 14:09:12


From: Gustavo Guerra [SMTP:gustavobt_at_[hidden]]
>
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/htm
> l/cpconformattingoverview.asp

It's interesting to note that MS turns all formatting responsiblities over
to the type being formatted. The equivalent, to our discussion, of their
formatting would be:

    cout << arg1.to_string("???") << " " << arg2.to_string("???") << endl;

This does not lend itself to reordering for i18n purposes, though the
individual values can be formatted appropriately. We can accomplish both by
extracting the relevant format codes for an argument and calling it's
format() mf with that format code (ignoring choice of syntax):

    cout << format("[1:xx]--[2:yy]")[val1][val2] << endl;

can be translated to:

    cout << val1.format("xx") << "--" << val2.format("yy") << endl;

(I'm sure this is the sort of thing the format class under discussion does
-- other than for built-in types -- by I thought it was useful to see the
parallel to MS' approach.)

Rob
Susquehanna International Group, LLP
http://www.sig.com


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