Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost Serialization callinga customserialize method
From: Robert Ramey (ramey_at_[hidden])
Date: 2010-08-25 12:22:56


Pooyan Dadvand wrote:
> Hi,
>
> First of all thank you for your kind suggestion. I completely agree
> about suggested methodology for optimizing. (Indeed this is the
> methodology I use in my work) However here my concern is the
> performance in normal use of container and not in seriliaztion and
> optimizing the serialization will be a secondary objective.
>
> What I need to know is how to call a MyCostumSerialize method of my
> derive object with an additional parameter via a pointer to the base
> class:
>
>
> Class VariableData{
> std::size_t m_Key;
> public:
>
> template<class TArchiveType>
> MyCostumSerialize(TArchiveType &rArchive, const unsigned int
> Version, void* pValue) {}
>
> };
>
> template<class TDataType>
> class Veriable : public VariableData {
> public:
>
> template<class TArchiveType>
> MyCostumSerialize(TArchiveType &rArchive, const unsigned int
> Version, void* pValue)
> {
> rArchive & static_cast<TDataType * >(pVAlue);
> }
>
> }
>
>
> Let say I don't how to call the MyCostumSerialize method of
> "Variable" class above when I have a "VariableData*" pointer in my
> container:
>
>
> std::vector<std::pair<const VariableData*, void*> >
>
>

Just rename MyCostumeSerialize to serialize

Robert Ramey



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