Boost logo

Boost :

From: Paul A Bristow (pbristow_at_[hidden])
Date: 2004-09-14 03:50:09


 

| -----Original Message-----
| From: boost-bounces_at_[hidden]
| [mailto:boost-bounces_at_[hidden]] On Behalf Of Reece Dunn
| Sent: 13 September 2004 18:28
| To: boost_at_[hidden]
| Subject: RE: [boost] Formal review of "Output Formatters"
| library begins today

 
| > "Boost prefers clarity to curtness".
|
| I have been giving this some thought. What I am looking at at
| the moment is
| something like:
|
| std::pair
| <
| std::pair< int, std::vector< char > >,
| std::list< boost::math::quaternion< float > >
| > mct;

Which leaves me puzzling what on earth mct can be short for !
myVeryContrivedContainerType?

Is this a complex demo assemblage?

| namespace io = boost::io;
| namespace fmt = boost::io::format;

using boost::io::format;

would allow you to replace fmt with format? Which is much easier to
understand,
especially for those for whom english is not their first language?

Have I commented this correctly (and informatively)?

| std::cout << io::object( mct,
| fmt::pair
| (
| fmt::pair( fmt::basic(), fmt::container()), // basic used for
int, container is a vector.
| fmt::container( fmt::nary()) // container is list, and n in the
nary is 4 for a quaternion.
| )
| );

| With io::delimiter holding one of the delimiter values.
| io::wrapped_delimiter will replace io::openclose_formatter in holding
open/close delimiter pairs

why wrappED? io::wrapper? ({} [] ...

| and io::sequence_delimiter replaces io::formatter.

io::separator? , | ...

(Of course, if English spelling made any sense whatever, it would be
separater - but it hasn't got to be the premier language by being phonetic,
consistent and logical, has it?)

Paul

PS
/rubbing_it_in_mode on

some filenames have the spelling mistake too ;-)
This may confuse some using search later.

/rubbing_it_in_mode off

docs boost::io::range has a misspell:
If you need to specify a range or sub-range, boost::io::formatob will not
****recongnise**** it unless it is a container.

template< typename CharT >
   struct FormatTraits
   {
      static const CharT open_default = implemenation defined;
      static const CharT close_default = implemenation defined;
      static const CharT separator_default = implemenation defined;
   };
_____________________________________________^^^^^^^^^^^^^ misspell.

and finally

  std::cout << boost::io::formatob( vec ).format( "{ ", " }" ); <<<<<<<<<<<
isn't this missing a ':' separator???
   // output: { 1 : 2 : 3 }


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