Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8484975
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T20:31:06+00:00 2026-06-10T20:31:06+00:00

I am using the boost example code to store a vector of pointers of

  • 0

I am using the boost example code to store a vector of pointers of objects in a file.
My vector is:

class VOMC{
public:
    vector<State*> vomc;
...
...
private:
    friend class boost::serialization::access;
    template<class Archive>
    void serialize(Archive & ar, const unsigned int version)
    {
        ar & vomc;
    }
}

This gives me the following error(among few more):

/usr/local/include/boost/serialization/access.hpp:118:9: error: ‘class State’ has no member named ‘serialize’

The error makes is probably telling me that I should also make my State object serializable(not sure on that one). Furthermore, I am confused because storing the pointers(addresses to memory) does not store the actual data, which will be freed upon program termination. Is there a workaround for the above situation? Even without boost.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T20:31:07+00:00Added an answer on June 10, 2026 at 8:31 pm

    You need serialize method for your State class.

    http://www.boost.org/doc/libs/1_51_0/libs/serialization/doc/index.html

    Each member of the array stops will be serialized. But remember each member is a pointer – so what can this really mean? The whole object of this serialization is to permit reconstruction of the original data structures at another place and time. In order to accomplish this with a pointer, it is not sufficient to save the value of the pointer, rather the object it points to must be saved. When the member is later loaded, a new object has to be created and a new pointer has to be loaded into the class member.

    Also i think you should read about serialization of pointers

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using boost::any to store pointers and was wondering if there was a
I am using boost shared pointers in my program, and I have a class
I'm trying to write a SSL-based async server using Boost ASIO example code from
I've this example code. #include <iostream> #include <boost/filesystem.hpp> using namespace std; int main() {
I am trying to expose this C++ class using Boost.Python: class VAlgorithm { public:
Simple example using boost::phoenix: #include <vector> #include <algorithm> #include <boost/phoenix.hpp> namespace ph = boost::phoenix;
I am not using boost libraries. How can i do this using STL? class
I'm using boost::asio, and I have code like this: void CServer::Start(int port) { tcp::acceptor
I have the following XML file and I want to store it using the
I'm implementing a variant class (not using boost) and I'm wondering how you'd handle

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.