Boost logo

Boost :

From: Allen Yao (yaozhen_at_[hidden])
Date: 2004-04-15 08:28:45


    It is not very convenient for me to use macros like
BOOST_SERIALIZATION_SPLIT_FREE, BOOST_SERIALIZATION_SPLIT_MEMBER
to deal with splitted load/save functions.
    Additionally, when dealing with load/save functions of
template class, these macros help little. Users also have to read
and understand what these macros actually do and write their own
serialize function to call split_free or split_member accordingly.
    I suggest that these implementation details on how the
serialization library determine to use single serialize function or
splitted load/save functions should be totally encapsulated and
hidden behind the scene.
    I suggest that a traits class to be used by the user instead of
macros like BOOST_SERIALIZATION_SPLIT_FREE. For example, the traits
class can be named "serialization_traits", its default implementation
is somthing as follows:

    template <typename T>
    struct serialization_traits {
        static const bool has_split_load_save = false;
    };

    It can be (partially) specialized for types that has split
load/save functions. Then, the serialization library can use this
traits class to determine whether to call a single serialize function
or splitted load/save functions for a specific type.
   Am I missing something?

Best regards.

Yao, Zhen


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