Boost logo

Boost Users :

From: Ruediger Berlich (ruediger.berlich_at_[hidden])
Date: 2007-03-31 12:24:53


Dear Robert,

thanks a lot! I can now, without any larger problem, serialize a class with
a signature similar to

class myClass
    :public vector<shared_ptr<base> >
{...};

which is what I wanted all along. "base" is a purely virtual class, and the
vector holds objects derived directly or indirectly from base. So this is
great!

Still, I'm not too sure what the problem was with the shared_ptr<int> . The
last line of the error messages says (and by the way, I'm using OpenSUSE
10.2, g++ 4.1.2, Boost 1.33.1):

"/usr/include/boost/serialization/access.hpp:109: error: request for member
serialize in t, which is of non-class type"

Presumably this is the comment you mention ? This seems to indicate that
the "driver" for the shared_ptr tried to treat the shared_ptr's template
arguments as a class object with a method "serialize", which of course
wouldn't work.

How can I teach the library that this particular shared_ptr just holds a
basic type ?

Thanks a lot for your help,
Ruediger

P.S.: Björn Karlsson mentions you as the author of Boost.Serialization in
his Boost book. So: congratulations - your library is great(!) work.

Robert Ramey wrote:
> STATIC_ASSERTION_FAILURE
>
> indicates that some error condition has been detected at compile time.
>
> In all such cases, there is a comment indicating the likely cause of the
> error. I don't know which version of boost your using so I can't look
> for the comment for you - but I'm sure you can find it now you know
> what to look for.
>
> Looking at you code, I can see you're trying to serialize a shared
> pointer to an integer. addresses of prmitive types (int) are by default
> not tracked as doing so would end up tracking ALL the ints serialized
> which is not what most people would expect. if you want to do this
> you'll have to wrap the int in a class so its type can be distuished
> and it can then be tracked. Then I believe that serializing a pointer
> to your wrapped class will function as you hope and expect.
>
> Robert Ramey

[... Original posting deleted - see archive ...]


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net