Boost logo

Boost :

From: troy d. straszheim (troy_at_[hidden])
Date: 2005-09-23 06:49:46


> On Sep 19, 2005, at 3:33 PM, Robert Ramey wrote:
>> I like the look of this - though I'm not really familiar enough
>> with boost::tuple to have a strong opinion. I also liked the test.
>> Has this been tested with msvc 6.5? This platform gave me a lot
>> of headaches with serialization of boost::variant but I went
>> through to maintain the idea that serialization is supported on
>> that platform.

I've put up a new implementation at

http://svn.resophonic.com/boost/serialization/tuple.hpp
http://svn.resophonic.com/boost/libs/serialization/test/test_tuple.cpp

per Jaako's comments.

This has been tested on gcc4 only, Robert. I saw how much the variant
code had to change on the way in. Sorry. I don't have ms platforms
available, and don't plan to. I seem to recall, when sifting through
the internals of serialization code, (e.g. when attempting to write
archives) finding those MS workarounds really distracting. Just so
there's a voice on the other side of
to-support-or-not-to-support-old-broken-ms question. Anyhow this one is
much simpler than variant.

> jarvi wrote:
> The implementation relies on the cons-list implementation of tuples.
> It is part of the public interface of Boost.Tuple, but not part of
> the TR1 specification. So if one wants to define serialization so
> that it works with any TR1 compatible tuple implementation, one must
> build the metafunctions around the get<N> templates. The downside of
> this is, that more compiler resources will be used.

So the tuple at boost/tuple/tuple.hpp doesn't have tuple_size<>. One is
forced to resort to using either the cons<> stuff, or lots of
preprocessor stuff. I went with cons.

> Also, at some point we'll roll in "Fusion" that will largely replace
> the current code of Boost.Tuple. Then we'll have more powerful means
> to iterate over tuples, in the style of MPL. But for now, my
> suggestion would be to consider implement serialization using TR1
> compatible facilities. Or be prepared to change the implementation
> when fusion is included into boost.
>
> Best, Jaakko

fusion::tuple, (which I discovered after reading your mail) however,
does provide tuple_size<>, so putting together serialization for
boost::fusion::tuple is straightforward, and that's what I did, have a look.

One thing I did notice while testing, though, is that one cannot
instantiate, for instance

tuple<bool,bool,bool,bool,bool, bool,bool,bool,bool,bool>

(ten bools), but nine are fine.

Am I missing something here? At any rate, the next option is the
implementation I just put up, which would only require change of a
couple header files and a using declaration if fusion::tuple moves.

-t


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