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 4021594
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:22:16+00:00 2026-05-20T10:22:16+00:00

I have a C++ application whose in-memory data set consists of a set of

  • 0

I have a C++ application whose in-memory data set consists of a set of objects, each of which has a key/value set attached. Objects and keys are referred to by an int id, and values are always instances of a single class. Key ids are unique in an object, objects ids are unique in the universe.

This is almost a map<pair<int, int>, value> except that I have the additional requirement that I need to be able to enumerate the keys attached to a particular object. And it all needs to be transactional, so I can roll back changes if things go wrong.

This all strikes me as being a totally standard problem for which I should be able to get off-the-shelf code, but I’ve been unable to find anything. Can anyone:

(a) tell me what this problem is actually called, so I know what to look for;

(b) suggest any code I should look at.

Note that I want this to be an in-memory data store only, so NoSQL approaches like Berkeley DB aren’t suitable — I don’t want to keep reading and writing value objects (which are moderately complex).

So far I’ve found either simple approaches that don’t do transactions (like boost_multi_index, or even just nested STL maps), or complex approaches using persistent storage, but nothing in between. I could implement my own transactional layer on top of basic storage, but to be honest, I’d rather not.

What am I missing?

Edit: well, nobody appears to have been able to suggest one; so I wrote my own. It is surprisingly fiddly but not actually very much code. Right now it’s just a template class using nested maps for storage but I’m considering changing to using boost::multi_index_container instead for simplicity. It’s not polished and probably riddled with bugs but if anyone thinks they can use it, let me know.

More Edit: for reference, it turns out that the Googleable name for what I’m looking for is a entity/attribute/value database (EAV).

  • 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-20T10:22:17+00:00Added an answer on May 20, 2026 at 10:22 am

    What you are really after is an exception safe container.

    Read these:
    http://www.boost.org/community/exception_safety.html
    http://lmzr.perso.neuf.fr/attic/Exception_Safe_Generic_Containers.pdf
    http://www.drdobbs.com/184401771;jsessionid=TTP1SXYYVJZPLQE1GHPCKH4ATMY32JVN

    Your problem quickly reduces to ensuring specific exception guarantees in the stored object’s constructor, copy constructor, assignment operator and so on.
    If this does not happen then it is likely you have not designed the object types with enough care to separation of concerns.

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

Sidebar

Related Questions

In a VB6 application, I have a Dictionary whose keys are String s and
I have an application which extracts data from an XML file using XPath. If
I have heard of desktop applications whose code has been open-sourced, but are there
I have an application which really should be installed, but does work fine when
I have an application that reads a CSV file with piles of data rows.
I have an application that sends messages to an external web service. I build
We have an application with a good amount of jQuery JSON calls to server
I have an application that displays an image inside of a Windows Forms PictureBox
I have an application deployed into multiple zones and there are some issues with
I have an application that uses NHibernate as its ORM and sometimes it experiences

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.