Boost logo

Boost Users :

From: Vjekoslav Brajkovic (balkan_at_[hidden])
Date: 2008-08-02 21:38:59


Hi,

         I receive a compile time error when I try to serialize
shared_ptr<string> in my class. Here are the relevant parts of this class:

/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8

#include <boost/serialization/base_object.hpp>
#include <boost/serialization/shared_ptr.hpp>
#include <boost/serialization/string.hpp>

class chunk_data : public chunk_metadata {

public:

   chunk_data(std::string s);

   chunk_data(
       chunk_metadata metadata,
       boost::shared_ptr<std::string> data_ptr);

   chunk_data(
       boost::filesystem::path path,
       chunk_metadata::cuid_type chunk_id);

         chunk_data(
       boost::filesystem::path path,
       chunk_metadata::cuid_type chunk_id,
       boost::shared_ptr<std::string> data_ptr);

         virtual ~chunk_data();

   template <typename Archive>
   void serialize(Archive& ar, const unsigned int version) {
     boost::serialization::base_object<chunk_metadata>(*this);
     ar & data_ptr_;
   }

         boost::shared_ptr<std::string> data_ptr_;
};

/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8

And here are the relevant parts from compilation error.

invalid application of ‘sizeof’ to incomplete type
‘boost::STATIC_ASSERTION_FAILURE<false>’
error: ‘struct std::basic_string<char, std::char_traits<char>,
std::allocator<char> >’ has no member named ‘serialize’

I haven't found any relevant hints about this error neither in the
documentation or on the boost mailing list. Also I've attached the compilation
log. I would really appreciate any help.

-Vjeko



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net