Boost logo

Boost Users :

Subject: Re: [Boost-users] [Serialization] Zero-sized arrays
From: Roland Kaminski (kaminski_at_[hidden])
Date: 2009-08-04 12:53:59


Hi,
I dived into the source code of the library and found a workaround to allocate
such objects. Unfortunately, I had to specialize a class in the Detail
namespace. With a hook in the pointer_iserializer and pointer_oserializer it
would have been very easy to implement this. I don't know whether there are
other cases where such an extension could be useful. Just wanted to let you
know that i found some solution. (see attachment)

Regards and thanks,
Roland

On Monday 03 August 2009 23:12:50 Matthias Troyer wrote:
> Uhhhh .... that is dangerous code. and this object is neither
> Assignable nor Copyable. Do you really need to make use of that
> optimization? In essence you need to control the memory allocation:
>
> Base *x = new(new unsigned char[sizeof(Derived) + 42 *
> sizeof(int)]) Derived(42);
>
> and have the serialization library do such a new operation instead of
> the default one. Robert, is there a hook for that?
>
>
> Matthias
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users




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