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

  • SEARCH
  • Home
  • 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 7007565
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:37:25+00:00 2026-05-27T21:37:25+00:00

for my application I am loading from the hardrive a list of different items:

  • 0

for my application I am loading from the hardrive a list of different “items”: these “items” are plain-old-data structs and represent the definitive list of all the “items” in my program.
So far what I do is that I simply put all the deserialized instances into one big std::vector and refer to them in the rest of my program by pointers. I am not supposed to have any “item” object anywhere else than in my std::vector that acts as a database.
Is there a good or specific design pattern for this case? I feel like sooner or later I will have item objects elsewhere than in my std::vector or that i’m using a method that is too simple to be robust
thanks

edit : for clarification’s sake, I am doing something like this (from memory):

struct Item {
    std::string name;
    int property; //etc
}

class Items {

static std::vector<Item> _list;

static void init() {

    Item new_item = readfromfile(...);
    _list.push_back(new_item)

}

}
  • 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-05-27T21:37:26+00:00Added an answer on May 27, 2026 at 9:37 pm

    If you are passing pointers around, a std::vector is a bad idea because the pointer will change when the vector needs to be reallocated. Consider using boost::ptr_vector and dynamic allocation.

    Apart from this minor consideration, a simple vector is the simplest storage possible and as good as any other when iteration is the only concern. I’d advise you to stay with it until other needs arise.

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

Sidebar

Related Questions

Currently I am loading data from a previous session into my application using the
I have an application that requires loading data from a network for a UITableView
I have an application loading CAD data (Custom format), either from the local filesystem
I´m loading data from MySQL DB into Java application. How to define column type?
I am loading data from a plist into a tableview in my application. Data
I am loading data from a resource within my own application, and the escape
I'm having trouble loading JQueryUI from Google's CDN. I've got an ASP.NET application that
I am trying to prevent a link in my jQTouch application from loading the
In my application I am loading xml from url in order to parse it.
I am developing an image gallery application .. Its loading images from the internet..

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.