The library already has serialization implemented for
boost::int64_t
which would be more portable. Maybe you want to try this.
Robert Ramey
"Rune Lund Olesen" wrote in message news:991ca2590905200817n2bf42782u917cfa38b86c4514@mail.gmail.com...
The code as posted looks solid to me.
This might be trivial, but
Checked that the code is actually included in the place where the serialization is instatiated ?
Have you tried replacing your typedefs with __int64 ? (thus removing the typedefs)
Or maybe use the STRONG_TYPEDEF macro that comes with serialization lib (undocumented i think).
On Wed, May 20, 2009 at 1:22 PM, Sandy Walsh wrote:
Steven Watanabe wrote:
See http://tinyurl.com/oqwk3v.
Thanks Steve, I tried that but I'm still getting no joy ...
Could it be that unsigned __int64 is not a class, but an integral data type?
I have two typedefs of unsigned __int64 type: TimeCode and FileSize. I'm assuming the compiler is smart enough to infer the difference.
I've changed my source according to the docs:
namespace boost
{
namespace serialization
{
template<class Archive>
void save(Archive & ar, const unsigned __int64& big, unsigned int version)
{
ar & sizeof(big);
ar.save_binary(&big, sizeof(big));
}
template<class Archive>
void load(Archive & ar, unsigned __int64& big, unsigned int version)
{
size_t size = sizeof(big);
ar.load_binary(&big, size);
}
}
};
BOOST_SERIALIZATION_SPLIT_FREE(unsigned __int64)
And it still complains with
VideoStorage.cpp
1>c:\src\storagetest\storagetest\videostorage.h(66) : error C2679: binary '&' : no operator found which takes a right-hand operand of type 'Storage::TimeCode' (or there is no acceptable conversion)
1> c:\program files\boost\boost_1_38\boost\archive\detail\interface_oarchive.hpp(70): could be 'Archive &boost::archive::detail::interface_oarchive<Archive>::operator &Storage::FileSize(T &)'
1> with
1> [
1> Archive=boost::archive::binary_oarchive,
1> T=Storage::FileSize
1> ]
1> while trying to match the argument list '(boost::archive::binary_oarchive, Storage::TimeCode)'
1> c:\program files\boost\boost_1_38\boost\serialization\access.hpp(93) : see reference to function template instantiation 'void Storage::Frame::save<Archive>(Archive &,const unsigned int) const' being compiled
1> with
1> [
1> Archive=boost::archive::binary_oarchive
1> ]
1> c:\program files\boost\boost_1_38\boost\serialization\split_member.hpp(43) : see reference to function template instantiation 'void boost::serialization::access::member_save(Archive &,T &,const unsigned int)' being compiled
1> with
1> [
1> Archive=boost::archive::binary_oarchive,
1> T=Storage::Frame
1> ]
1> c:\program files\boost\boost_1_38\boost\serialization\split_member.hpp(42) : while compiling class template member function 'void boost::serialization::detail::member_saver::invoke(Archive &,const T &,const unsigned int)'
1> with
1> [
1> Archive=boost::archive::binary_oarchive,
1> T=Storage::Frame
1> ]
1> c:\program files\boost\boost_1_38\boost\serialization\split_member.hpp(69) : see reference to class template instantiation 'boost::serialization::detail::member_saver' being compiled
1> with
1> [
1> Archive=boost::archive::binary_oarchive,
1> T=Storage::Frame
1> ]
1> c:\src\storagetest\storagetest\videostorage.h(78) : see reference to function template instantiation 'void boost::serialization::split_member(Archive &,T &,const unsigned int)' being compiled
1> with
1> [
1> Archive=boost::archive::binary_oarchive,
1> T=Storage::Frame
1> ]
1> c:\program files\boost\boost_1_38\boost\serialization\access.hpp(109) : see reference to function template instantiation 'void Storage::Frame::serialize<Archive>(Archive &,const unsigned int)' being compiled
1> with
1> [
1> Archive=boost::archive::binary_oarchive
1> ]
1> c:\program files\boost\boost_1_38\boost\serialization\serialization.hpp(74) : see reference to function template instantiation 'void boost::serialization::access::serialize(Archive &,T &,const unsigned int)' being compiled
1> with
1> [
1> Archive=boost::archive::binary_oarchive,
1> T=const Storage::Frame
1> ]
1> c:\program files\boost\boost_1_38\boost\serialization\serialization.hpp(133) : see reference to function template instantiation 'void boost::serialization::serialize(Archive &,T &,const unsigned int)' being compiled
1> with
1> [
1> Archive=boost::archive::binary_oarchive,
1> T=const Storage::Frame
1> ]
1> c:\program files\boost\boost_1_38\boost\archive\detail\oserializer.hpp(148) : see reference to function template instantiation 'void boost::serialization::serialize_adl(Archive &,T &,const unsigned int)' being compiled
1> with
1> [
1> Archive=boost::archive::binary_oarchive,
1> T=const Storage::Frame
1> ]
1> c:\program files\boost\boost_1_38\boost\archive\detail\oserializer.hpp(140) : while compiling class template member function 'void boost::archive::detail::oserializer::save_object_data(boost::archive::detail::basic_oarchive &,const void *) const'
1> with
1> [
1> Archive=boost::archive::binary_oarchive,
1> T=Storage::Frame
1> ]
1> c:\program files\boost\boost_1_38\boost\archive\detail\oserializer.hpp(236) : see reference to class template instantiation 'boost::archive::detail::oserializer' being compiled
1> with
1> [
1> Archive=boost::archive::binary_oarchive,
1> T=Storage::Frame
1> ]
1> c:\program files\boost\boost_1_38\boost\archive\detail\oserializer.hpp(230) : while compiling class template member function 'void boost::archive::detail::save_non_pointer_type::save_standard::invoke(Archive &,const Storage::Frame &)'
1> with
1> [
1> Archive=boost::archive::binary_oarchive,
1> T=Storage::Frame
1> ]
1> c:\program files\boost\boost_1_38\boost\archive\detail\oserializer.hpp(294) : see reference to class template instantiation 'boost::archive::detail::save_non_pointer_type::save_standard' being compiled
1> with
1> [
1> Archive=boost::archive::binary_oarchive,
1> T=Storage::Frame
1> ]
1> c:\program files\boost\boost_1_38\boost\archive\detail\oserializer.hpp(282) : while compiling class template member function 'void boost::archive::detail::save_non_pointer_type::invoke(Archive &,const Storage::Frame &)'
1> with
1> [
1> Archive=boost::archive::binary_oarchive,
1> T=Storage::Frame
1> ]
1> c:\program files\boost\boost_1_38\boost\archive\detail\oserializer.hpp(506) : see reference to class template instantiation 'boost::archive::detail::save_non_pointer_type' being compiled
1> with
1> [
1> Archive=boost::archive::binary_oarchive,
1> T=Storage::Frame
1> ]
1> c:\program files\boost\boost_1_38\boost\archive\detail\common_oarchive.hpp(64) : see reference to function template instantiation 'void boost::archive::save(Archive &,const T &)' being compiled
1> with
1> [
1> Archive=boost::archive::binary_oarchive,
1> T=const Storage::Frame
1> ]
1> c:\program files\boost\boost_1_38\boost\archive\basic_binary_oarchive.hpp(63) : see reference to function template instantiation 'void boost::archive::detail::common_oarchive<Archive>::save_override<const T>(T &,int)' being compiled
1> with
1> [
1> Archive=boost::archive::binary_oarchive,
1> T=const Storage::Frame
1> ]
1> c:\program files\boost\boost_1_38\boost\archive\binary_oarchive_impl.hpp(45) : see reference to function template instantiation 'void boost::archive::basic_binary_oarchive<Archive>::save_override<const T>(const T &,int)' being compiled
1> with
1> [
1> Archive=boost::archive::binary_oarchive,
1> T=const Storage::Frame
1> ]
1> c:\program files\boost\boost_1_38\boost\archive\detail\interface_oarchive.hpp(64) : see reference to function template instantiation 'void boost::archive::binary_oarchive_impl::save_override<T>(T &,int)' being compiled
1> with
1> [
1> Archive=boost::archive::binary_oarchive,
1> Elem=char,
1> Tr=std::char_traits<char>,
1> T=const Storage::Frame
1> ]
1> c:\src\storagetest\storagetest\videostorage.cpp(73) : see reference to function template instantiation 'Archive &boost::archive::detail::interface_oarchive<Archive>::operator <<<const Storage::Frame>(T &)' being compiled
1> with
1> [
1> Archive=boost::archive::binary_oarchive,
1> T=const Storage::Frame
1> ]
1>c:\src\storagetest\storagetest\videostorage.h(67) : error C2679: binary '&' : no operator found which takes a right-hand operand of type 'Storage::FileSize' (or there is no acceptable conversion)
1> c:\program files\boost\boost_1_38\boost\archive\detail\interface_oarchive.hpp(70): could be 'Archive &boost::archive::detail::interface_oarchive<Archive>::operator &Storage::FileSize(T &)'
1> with
1> [
1> Archive=boost::archive::binary_oarchive,
1> T=Storage::FileSize
1> ]
1> while trying to match the argument list '(boost::archive::binary_oarchive, Storage::FileSize)'
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users
------------------------------------------------------------------------------
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users