Boost logo

Boost Users :

Subject: [Boost-users] [Serialization] Compile error in load_wrapper
From: Ryan Fowler (Ryan.Fowler_at_[hidden])
Date: 2009-03-02 04:59:15


Hi, I am having trouble serializing a class. Actually, I am having
trouble compiling the class as below. The actual archiving is behind an
interface (hence the Save and Load methods) which may work (once I get
this sorted, I'm going to look at the export traits), but the error
points to me not declaring the is_wrapper properly.

 

My class:

 

BOOST_CLASS_IS_WRAPPER(Frame);

 

class Frame

{

...

 

// Serialize interface

uint32 Save( uint8* pStream )

{

    ostrstream os( (char*)pStream, STREAM_SIZE );

    boost::archive::text_oarchive oa(os);

    oa << this;

    return os.pcount();

}

void Load( uint8* pStream )

{

    istrstream is( (char*)pStream, STREAM_SIZE );

    boost::archive::text_iarchive ia(is);

    ia >> this;

}

 

friend class boost::serialization::access;

template< class Archive >

void serialize( Archive& ar, const unsigned int version )

{

    string strObjectType = "IFrame";

    ar << strObjectType.length() << strObjectType;

    ar << m_lMaxFrameLength << m_lDataLength << m_uiTimeStamp;

    ar << boost::serialization::make_binary_object( (void*)(this + 1),
m_lMaxFrameLength );

}

 

My error:

 

W:\NewFramework\Boost\boost/archive/detail/iserializer.hpp(541) : error
C2664: 'boost::archive::load_wrapper' : cannot convert parameter 3 from
'boost::serialization::is_wrapper<T>' to 'boost::mpl::true_'

1> with

1> [

1> T= Frame *

1> ]

1> No user-defined-conversion operator available that can perform
this conversion, or the operator cannot be called

1>
W:\NewFramework\Boost\boost/archive/detail/common_iarchive.hpp(59) : see
reference to function template instantiation 'void
boost::archive::load<Archive,const T>(Archive &,const T &)' being
compiled

1> with

1> [

1> Archive=boost::archive::text_iarchive,

1> T= Frame *const

1> ]

1>
W:\NewFramework\Boost\boost/archive/basic_text_iarchive.hpp(62) : see
reference to function template instantiation 'void
boost::archive::detail::common_iarchive<Archive>::load_override<T>(T
&,int)' being compiled

1> with

1> [

1> Archive=boost::archive::text_iarchive,

1> T= Frame *const

1> ]

1> W:\NewFramework\Boost\boost/archive/text_iarchive.hpp(65) :
see reference to function template instantiation 'void
boost::archive::basic_text_iarchive<Archive>::load_override<T>(T &,int)'
being compiled

1> with

1> [

1> Archive=boost::archive::text_iarchive,

1> T= Frame *const

1> ]

1>
W:\NewFramework\Boost\boost/archive/detail/interface_iarchive.hpp(61) :
see reference to function template instantiation 'void
boost::archive::text_iarchive_impl<Archive>::load_override<T>(T &,int)'
being compiled

1> with

1> [

1> Archive=boost::archive::text_iarchive,

1> T= Frame *const

1> ]

1>
w:\newframework\framework\sourcecode\includes\RDCFrameFactoryImpl\RDCFra
me.h(262) : see reference to function template instantiation 'Archive
&boost::archive::detail::interface_iarchive<Archive>::operator >><
Frame*const >(T &)' being compiled

1> with

1> [

1> Archive=boost::archive::text_iarchive,

1> T= Frame *const

1> ]

 

 

Thanks,

Ryan

Ryan Fowler
Software Engineer

Thomson Reuters

Phone: +442075427063

ryan.fowler_at_[hidden]
thomsonreuters.com

This email was sent to you by Thomson Reuters, the global news and information company.
Any views expressed in this message are those of the individual sender, except where the sender specifically states them to be the views of Thomson Reuters.



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