Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost Serialization calling a custom serialize method
From: Robert Ramey (ramey_at_[hidden])
Date: 2010-08-18 12:17:50

Pooyan Dadvand wrote:
> Hi,
> I'm trying to use the boost serialization in our project "Kratos" (a
> Multi-physics finite element code) in which I found the following
> problem, I have a class Variable which is derived from VariableData
> as follow:
> Class VariableData
> {
> std::size_t mKey;
> public:
> .....
> };
> template<class TDataType>
> class Variable : public VariableData
> {
> ....
> }

Seems to me that what would work is:

Class VariableData{
    std::size_t m_Key;
    virtual ~VariableData() = 0;

template<class TDataType>
class Veriable : public VariableData {

This would work with the library in a normal way.

> Now I have a container which holds a pairs, consist of VariableData
> pointer to the Variable and a void* pointer to its value:
> std::vector<std::pair<const VariableData*, void*> >

I can't understand what the "void *" could possibly be useful for here.
Nor can I understand why you would use it. The whole idea
of trying to serialize a "void *" seems totally non-sensical to me. I have
no idea how or way one would want to do this.

Robert Ramey

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at