try adding
#include
"Rich Peters" wrote in message news:99f885c90710180916m633d3986v951950936164912@mail.gmail.com...
I have been having some issues trying to get this relatively simple binary memory based serialization to work.
If I use a byte type below, I get errors with not finding a matching ctor:
If I use a char, it compiles and thows an exception in binary_iarchive_impl.hpp at line 52:
this->basic_binary_iarchive<Archive>::init();
which appears to be related to char string processing.
can anyone help me sort this out?
thanks
Rich
======================
#include
#include
#include
#include
#include
....
std::vector<byte> store(1000, 0x00) ;
// std::vector<char> store(1000, 0x00) ; // other test
boost::iostreams::stream theStream(&store[0], &store[0]+store.size()) ;
// save data to archive
{
boost::archive::binary_oarchive oa(theStream);
oa & theInfo;
// archive closed when destructors are called
}
c:\Program Files\boost\boost_1_34_1\boost\iostreams\stream.hpp(112) : error C2665: 'boost::iostreams::basic_array<Ch>::__ctor' : none of the 5 overloads can convert parameter 1 from type 'unsigned char *__w64 const '
with
[
Ch=char
]
and
[
Ch=char
]
c:\Program Files\boost\boost_1_34_1\boost\iostreams\device\array.hpp(90): could be 'boost::iostreams::basic_array<Ch>::basic_array(boost::iostreams::basic_array<Ch>::char_type *,boost::iostreams::basic_array<Ch>::char_type *)'
with
[
Ch=char
]
c:\Program Files\boost\boost_1_34_1\boost\iostreams\device\array.hpp(90): or 'boost::iostreams::basic_array<Ch>::basic_array(boost::iostreams::basic_array<Ch>::char_type *,size_t)'
with
[
Ch=char
]
c:\Program Files\boost\boost_1_34_1\boost\iostreams\device\array.hpp(90): or 'boost::iostreams::basic_array<Ch>::basic_array(const boost::iostreams::basic_array<Ch>::char_type *,const boost::iostreams::basic_array<Ch>::char_type *)'
with
[
Ch=char
]
c:\Program Files\boost\boost_1_34_1\boost\iostreams\device\array.hpp(90): or 'boost::iostreams::basic_array<Ch>::basic_array(const boost::iostreams::basic_array<Ch>::char_type *,size_t)'
with
[
Ch=char
]
while trying to match the argument list '(unsigned char *__w64 const , unsigned char *__w64 const )'
c:\Dev\Shared-ADL Integration\UnitTest\BoostSerialization\BoostSerialization\Serialize.h(194) : see reference to function template instantiation 'boost::iostreams::stream<Device>::stream::value_type*__w64 ,std::allocator<_Ty>::value_type*__w64 >(const U0 & ,const U1 & )' being compiled
with
[
Device=boost::iostreams::array,
_Ty=unsigned char,
U0=std::allocator<unsigned char>::value_type *__w64 ,
U1=std::allocator<unsigned char>::value_type *__w64
]
thanks
Rich
Matthias Troyer wrote:
You can use the Boost IOstreams library to create an iostream using a memory buffer and use that with the binary archives
Matthias
------------------------------------------------------------------------------
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users