
Hi Ariel, if you want to use char* to deal with text, I'd recommend to use std::string instead, if you're interested in an array, you might want to consider using a std::vector. If you can't do this for some reason, here's some code which serializes a DREAL* (DREAL=double) and should work similarly for char*: friend class boost::serialization::access; template<class Archive> void save(Archive & ar, const unsigned int version) const { ar & num_labels; for (int i=0; i < num_labels; ++i) { ar & labels[i]; } } template<class Archive> void load(Archive & ar, const unsigned int version) { ar & num_labels; if (num_labels > 0) { labels = new DREAL[num_labels]; for (int i=0; i< num_labels; ++i) { ar & labels[i]; } } } BOOST_SERIALIZATION_SPLIT_MEMBER(); Cheers, Chris Ariel Brunetto wrote:
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.
mailto: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! http://www.live.com/getstarted.aspx
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org mailto:Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- ________________ Ariel Brunetto www.aquadize.com http://www.aquadize.com ------------------------------------------------------------------------
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users