Note that there are some explanatory texts on larger screens.

plurals
  1. POC++ Boost ptr_map serialization error
    primarykey
    data
    text
    <p>I have some code that I want to build. The code uses boost::ptr_map class to serialize certain objects. I have Visual Studio 2008 with boost1.38 and I am getting following error from compiler. I wonder if any one else has seen any thing like this.</p> <p>C2039: 'serialize' : is not a member of 'boost::ptr_map'</p> <p>Looks like some reference is missing and I wonder what it is, I don't see any boost/serialization/ptr_map. I have Googled a lot and nothing has proved to be viable. I have created a sample code that generates the same error below</p> <pre><code>#include &lt;fstream&gt; #include &lt;iostream&gt; #include &lt;boost/archive/text_oarchive.hpp&gt; #include &lt;boost/archive/text_iarchive.hpp&gt; #include &lt;boost/config.hpp&gt; #include &lt;boost/shared_ptr.hpp&gt; #include &lt;boost/ptr_container/ptr_map.hpp&gt; #include &lt;boost/serialization/string.hpp&gt; #include &lt;boost/serialization/version.hpp&gt; #include &lt;boost/serialization/split_member.hpp&gt; using namespace std; class User { boost::ptr_map&lt;std::string, string&gt; ptrmap; public: friend class boost::serialization::access; template&lt;class Archive&gt; void serialize(Archive &amp; ar, const unsigned int version) { ar &amp; ptrmap; } bool save(const std::string&amp; filename) { ofstream ofs(filename.c_str()); if(ofs.good() == false) { return false; } try { boost::archive::text_oarchive oa(ofs); oa &lt;&lt; (*this); } catch(...) { throw; } return true; } }; int main() { User user; user.save("C:\\test.db"); return EXIT_SUCCESS; } </code></pre> <p>Any help is appreciated.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload