From: Vladimir Prus (ghost_at_[hidden])
Date: 2003-12-16 08:35:33
Beman Dawes wrote:
> There is a discussion going on now on the C++ committee's library
> reflector, summed up by Pete Becker:
> > Yes, there is a general need for displaying an ordered set (in the
> > broadest sense) of things, whether we call that set a pair, a tuple, a
> > container, a complex number, or whatever.
> Discussion included ways of providing user customizable formatting for
> such display.
> This strikes me as the same problem as the much discussed (on Boost) issue
> of user-customizable serialization formats.
> I wonder what those who have been following Robert Ramey's serialization
> proposal closely think? Could one mechanism solve both serialization and
> display needs?
I don't think that the current serialization library cannot be used for
display. I've used library by Terje Slettebo for that and was/is quite
happy with it.
The serialization library just breaks down complex object to bytes and
stores them. The archive classes store bytes and the 'serialize' function,
specific for each class, decides what to store.
At the moment, there's no way to store extra decorations from 'serialize'
function, like comma between pair elements. It's probably possible to add
method like 'add_decoration(char*)' to archive, but there are performance
concerns, and besides, existing text_archive is not human-readable anyway.
Further, if customization of display format is required, that's an issue
completely separate from serialization. In fact, it adds some complexity to
It's probably possible to create custom archive, which produces
human-readable output and inserts separators between all elements that are
output to it. It would also add begin/end braces. Robert said it wrote docs
on writing custom archives, so somebody might have a look at it and try.
I'm definitely scared to try it myself ;-)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk