> 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 -----
From: Ariel Brunetto
To: boost-users@lists.boost.org
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
On Wed, Apr 9, 2008 at 4:17 AM, Igor R. <igor_rubinov@hotmail.com> wrote:
> Sorry, but I dont understand. The documentation says that I can serialize a pointer to a Serializable type such as a primitive type. Is this true?
 
Yes, but in case of pointer to const char your primitive type is const char.
 


Get news, entertainment and everything you care about at Live.com. Check it out!

_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users



--
________________
Ariel Brunetto
www.aquadize.com


_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users