Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2003-10-30 04:36:22

I've just wrote the following:

template<class Archive, class T>
void save(Archive & ar, const boost::scoped_ptr<T> & t, unsigned int version)
    ar << t.get();

template<class Archive, class T>>
void load(Archive & ar, boost::scoped_ptr<T> & t, unsigned int version)
    T* r;
    ar >> r;

The reason why I wrote save and load, as opposed to 'serialize' are hopefully
clear -- the logic is somewhat different. Now, I'd like serialization lib to
use those functions so I write


and here I'm stuck, because I can't write scoped_ptr<T> as argument to the
macro -- only concrete type. What am I to do?

Of course, I can declare 'serialize' which does the right thing, but I can do
that only because I looked at the code, which should be be necessary for this
case. So, I believe either docs must cover this use case, or new macros for
templates should be added.

I also have a minor suggestion.

Both iserializer.hpp and oserializer.hpp have the following piece of code.

                    tracking_level<T>, mpl::int_<track_never>^M

When this assert fires, I get

error: invalid application of
   `sizeof' to an incomplete type

And that's hard to understand. It would be nice if this assert were factored
out into a separate helper function or class, which can be written like this
(untested code)

        // same static assert as above.

This is just an idea, feel free to toss it.

- Volodya

Boost list run by bdawes at, gregod at, cpdaniel at, john at