|
Boost : |
From: Karl Nelson (kenelson_at_[hidden])
Date: 2002-01-31 12:28:03
Updated the submission to incorperate suggested improvements.
Changes
* supports positional only for those to lazy to
write "%1$s"
cout << format("I have %1% %2%.", num_items, item_type);
* switched __ to _p_ to meet standard.
* moved internals to directory.
* changed headers to hpp.
* macrod group.
* switched group to take by value for "hex"
Unanswered questions:
Should it try to support all of printf output options or
simply support that which iostreams allow and eat them for
compatiblity?
Should non-iostream things like truncate be affectable
by manipulators?
Does cout << format("%#010x" , complex<int>(20,21) ); mean
A) the user wants all integers output to be show base with
12 charactors zero padded. 0x00000016+0x00000017i
B) The total width should be 10 with showbase and zero padding?
0x16+0x17i
?
Should formating of int and float be in iostream instead
Ie.
os.float_format("##.####");
os.int_format("0x0######",hex);
rather than the simple state machine?
Suggestions not yet incorperated.
- Checking for too many parameters.
- The following should silently swallow the "foo" argument:
cout << format("%2$s", "foo", "bar");
Right now, it invokes undefined behavior.
- 'bad_format_string' should derive from 'std::exception'.
--Karl
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk