Boost logo

Boost Users :

From: Robert Ramey (ramey_at_[hidden])
Date: 2006-08-01 11:15:04


Cheok Yan Cheng wrote:
> Hmmm - I think the map size is already saved to disk.
> If you just
> copy the current templated implementation for map
> loading and
> instantiate a specialized version for your case, I
> would think
> that would handle the job.
>
> Robert Ramey
>
> -------------------------------------------------------
> I am sorry. However, I do not quite understand.
>
> Let me more specific to my case.
>
> I have a data structure:
>
> map<const FiducialPair *, vector<RectPair> >
> fiducialPairSearchRegionMap;
>
> Both FiducialPair and RectPair can be serialized with
> boost no problem.
>
> I try to serialize the whole map by
>
> void save(Archive & ar, const unsigned int
> version) const
> {
> ar & fiducialPairSearchRegionMap;
> }
>
> void load(Archive & ar, const unsigned int
> version)
> {
> ar & fiducialPairSearchRegionMap;
> }
>
> I would get the following error:
>
> C:\Boost\include\boost-1_33_1\boost\archive\detail\iserializer.hpp(487):
> error C2440: 'reinterpret_cast' : cannot convert from
> 'typef *__w64 ' to 'void ** '

I wouldn't know what to do about the above. I don't even know what
"typef" is. What compiler is this?

> C:\Boost\include\boost-1_33_1\boost\archive\detail\iserializer.hpp(493):
> error C2664: 'T
> *boost::archive::detail::load_pointer_type<Archive,Tptr>::pointer_tweak<const
> FiducialPair>(const
> boost::serialization::extended_type_info &,void *,T
> &)' : cannot convert parameter 2 from 'typef ' to
> 'void *'
> with
> [
> T=const FiducialPair,
> Archive=boost::archive::text_iarchive,
> Tptr=typef
> ]
> Conversion loses qualifiers
>
> May I know how I can apply ur suggested solution to my
> case?

I would hope that the following blunt instrument might work:

void load(Archive & ar, const unsigned int version)
{
    ar >> reinterpret_cast<map<FiducialPair *, vector<RectPair>
>(fiducialPairSearchRegionMap);
}

or maybe

void load(Archive & ar, const unsigned int version)
{
    void * xptr;
    xptr = & fiducialPairSearchRegionMap;
    map<FiducialPair *, vector<RectPair> > *mptr;
    mptr = static_cast<map<FiducialPair *, vector<RectPair> > >(xptr);
    ar >> *mptr;
}

>
> Thank you.
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com


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