Boost logo

Boost :

From: John Torjo (john.lists_at_[hidden])
Date: 2004-09-22 02:05:21


Rozental, Gennadiy wrote:

>>>Here some question I've got while reading submitted library.
>>>
>>>1. What is an advantage if using this library for scalar types (vs.
>>>defining
>>>operator<<)
>>
>>Do you mean for things like int, Person, etc. If that is the
>>case, the
>>default behaviour of the library is to delegate output of
>>these types to
>>operator<<, so it doesn't do much. However, with support for a
>>fmt::serialize formatter that calls 'serialize' instead of
>><<, you can
>>register a particular class as being serializable so my type
>>deduction
>>system knows to associate instances of that type with
>>fmt::serialize, so you
>>can then do:
>>
>> // new design
>> std::cout << io::object( my_serializable_object ) << '\n';
>> std::cout << io::object( vec_of_serializable_objects ) <<
>>'\n'; // [ ...,
>>..., ... ]
>
>
> I don't really interested in another serialization library. We already have
> one.
>
>

Reece was answering a request from Vladimir Prus - who wanted the outfmt
library to use the "serialize" function if it exists, or a default
(operator<<) otherwise.

Best,
John

-- 
John Torjo
-- john_at_[hidden]
Contributing editor, C/C++ Users Journal
-- "Win32 GUI Generics" -- generics & GUI do mix, after all
-- http://www.torjo.com/win32gui/
-- v1.4 - save_dlg - true binding of your data to UI controls!
    + easily add validation rules (win32gui/examples/smart_dlg)

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