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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T05:55:52+00:00 2026-05-25T05:55:52+00:00

So I want to store pairs string-path <-> my_file_object in such container with expected

  • 0

So I want to store pairs string-path <-> my_file_object in such container with expected total object size 100 000.

  • I need to have search by absolute path to get an object for example I could search for a/b/c/file.h)
  • I need to be capable to list all item names in folder like folder a/b/c/ contains files file.h, file.cpp, folder bin/ and folder bin2/
  • I need to be capable to add new files by absolute path, and update them.
  • I need to be capable to delete files.

I wonder about fiew things – is there a container for such things in STL/boost? Is this implementation threadsafe for read?

Also I wonder if it is any way faster than have all my pairs inside of std::map<string, object> so I would have fast search, fast insert and delete, and folder files listing via code like this?

  • 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-25T05:55:52+00:00Added an answer on May 25, 2026 at 5:55 am

    What requirements do you have that rule out std::map? As far as I can see it will work well here:

    typedef std::map<std::string,file_object_t> paths_t;
    paths_t paths;
    
    //I need to have search by absolute path
    paths_t::iterator fileIterator = paths.find("a/b/c/file.h");
    if( fileIterator  != paths.end() ) {
      ...
    } 
    
    //I need to be capable to list all item names in folder like folder a/b/c/
    std::string folder = "a/b/c/";
    paths_t::iterator folderBegin = paths.upper_bound(folder );
    paths_t::iterator folderEnd = paths.upper_bound(folder+MAX_CHAR);
    std::for_each(folderBegin,folderEnd,...);
    
    //I need to be capable to add new files by absolute path
    if( !paths.insert(paths_t::value_type("a/b/c/file.h",file)).second ) {
      //add file failed 
    }
    
    //and update them.
    paths["a/b/c/file.h"].some_method_that_updates_file();
    
    //I need to be capable to delete files
    paths.erase(fileIterator);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What I want is the ability to store name,object pairs. Unlike objC c#'s Dictionary
I need to store a collection of Point pairs, but don't want to use
I am using C++ hash_map to store some C-style string pairs. And all keys
I need to use STL C++ map to store key value pairs. I need
I want to store key/value pairs in URI's after the hash for use on
I have a list of key/value pairs of configuration values I want to store
I want to store a bunch of key value pairs, with the key being
I want to store in array pairs of unicode chars (char, number of instances
I have a string containing field/value pairs in xml format and want to parse
I want to store a number of key-value pairs in a flat file. A

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.