> Yes, but I am trying to serialize a char*, not a
const char*. Is it possible?
Not directly. If you cannot reengineer the use of the
char* do something like this: (apologies if you know this already)
// char* m_POD; a pointer to plain old char
data
// size_t sizePOD; // how big is the POD data
//...
if (Archive::is_saving::value)
{
// create a vector and fill with
POD
std::vector<char>
vec(m_POD,m_POD+sizePOD);
// now serialize
ar
& BOOST_SERIALIZATION_NVP(vec);
}
else if
(Archive::is_loading::value)
{
std::vector<char>
vec;
ar & BOOST_SERIALIZATION_NVP(vec);
// now handle
deallocation of existing POD
// reallocation and copying from
vec
if (m_POD)
{
delete
m_POD;
}
// allocate POD buffer
m_POD = new
char[vec.size()];
// copy from deserialized
vector
std::copy(vec.begin(),vec.end(),m_POD);
}
HTH
----- Original Message -----
Sent: Wednesday, April 09, 2008 11:59
AM
Subject: Re: [Boost-users] Problems with
char* serialization
Yes, but I am trying to serialize a char*, not a const char*. Is it
possible?
Thank you,
Ariel
--
________________
Ariel Brunetto
www.aquadize.com
_______________________________________________
Boost-users mailing
list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users