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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T16:32:41+00:00 2026-05-14T16:32:41+00:00

i need to serialize directory tree. i have no trouble with this type: std::map<

  • 0

i need to serialize directory tree.
i have no trouble with this type:

std::map<
   std::string, // string(path name)
   std::vector<std::string> // string array(file names in the path)
> tree;

but for the serialization the directory tree with the content i need other type:

std::map<
   std::string, // string(path name)
   std::vector< // files array
      std::pair<
         std::string, // file name
         std::vector< // array of file pieces
            std::pair< // <<<<<<<<<<<<<<<<<<<<<< for this i need lazy initialization
               std::string, // piece buf
               boost::uint32_t // crc32 summ on piece
            >
         >
      >
   >
> tree;

how can i initialize the object of type “std::pair” in the moment of its serialization?
i.e. read file piece/calculate crc32 summ.

up

  • 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-14T16:32:41+00:00Added an answer on May 14, 2026 at 4:32 pm

    I would replace the std::string in the vector by a custom class, let me say MyFileNames

    class MyFileNames : std::string
    {
    // add forward constructors as needed
    
    };
    
    std::map<
       std::string, // string(path name)
       std::vector<MyFileNames> // string array(file names in the path)
    > tree;
    

    And define the save serialization function for MyFileNames by converting the std::string to a

    std::pair<
         std::string, // file name
         std::vector< // array of file pieces
            std::pair< // <<<<<<<<<<<<<<<<<<<<<< for this i need lazy initialization
               std::string, // piece buf
               boost::uint32_t // crc32 summ on piece
            >
         >
    >
    

    and the serialize this type.
    This let you evaluate the lazy part only the data is serialized. For the load you could ignore the lazy data, as I suppose that this data can be calculated.

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

Sidebar

Ask A Question

Stats

  • Questions 498k
  • Answers 498k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Surely a reasonable grouping is to use separate source files.… May 16, 2026 at 12:10 pm
  • Editorial Team
    Editorial Team added an answer This is a bug in PyDev; in this case ignore… May 16, 2026 at 12:10 pm
  • Editorial Team
    Editorial Team added an answer There were some additional comments that I posted. But I… May 16, 2026 at 12:10 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

For my application, I need to serialize data to file using XML, so I
With an application I'm currently developing I've come across the need to serialize some
I have a database (MySql) and need to store some results from a web
I am having problems trying to serialise a vector (std::vector) into a binary format
I'm trying to figure out the best way to save (serialize) and later open
I have written a program which analyzes a project's source code and reports various
I currently store a serialized XML file in the application directory that contains all
I have a .NET Windows Mobile 5.0 application that is used for data collection.
I've a custom form (created with form API) that need send an uploaded file
Lets say I have business class: public class Foo { public int Prop1 {get;set;}

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.