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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T03:01:20+00:00 2026-05-24T03:01:20+00:00

This is kind of last resort.. So I have two maps. typedef std::map <string,

  • 0

This is kind of last resort..

So I have two maps.

typedef std::map <string, vector<float> > Dict;
typedef std::map <string, string> Dict1;

The contents of the first map look like this:
Dict = {A: -3.1, 2.1, 1.1}; {B: -4.5, 5.6, 7.2}…

Strings from the second map are same as keys from the first one.
Dict1 = {A: B};…

I need to create something like:

Dict2 = {-3.1, 2.1, 1.1:  -4.5, 5.6, 7.2}... 

or two place them in two vectors, but with possibility of reconstructing the structure of Dict1.. Technically these are coordinates for some points.

I actually went the second route and tried to create two vectors and then match them, but, apparently I made some mistake.. Here is what I have:

typedef std::map <string, vector<float> > Dict;
typedef std::map <string, string> Dict1;

typedef std::vector<float> V1;

V1 v1;
V1 v2;

Dict d;
Dict d1;


//Here is the code, I know, oh well...



for( map<string, vector<float> >::iterator iter0 = d.begin(); iter0 != d.end(); ++iter0 ) {

    for( map<string, string >::iterator iter1 = d1.begin(); iter1 != d1.end(); ++iter1 ) {

        vector <float> tempVal0 = (*iter0).second;
        string tempKey0 = (*iter0).first;

        string tempVal1 = (*iter1).second; 
        string tempKey1 = (*iter1).first;

        size_t comp1 = tempKey0.compare(tempKey1);
        if(comp1 == 0 ){
            for (unsigned i = 2; i < tempVal0.size(); i++) {
            v1.push_back(tempVal0[i-2]);
            v1.push_back(tempVal0[i-1]);
            v1.push_back(tempVal0[i]);

                for( map<string, vector<float> >::iterator iter00 = d.begin(); iter00 != d.end(); ++iter00 ) {

                    for( map<string, string >::iterator iter11 = d1.begin(); iter11 != d1.end(); ++iter11 ) {
                        vector <float> tempVal00 = (*iter00).second;
                        string tempKey00 = (*iter00).first;

                        string tempVal11 = (*iter11).second; 
                        string tempKey11 = (*iter11).first;

                        size_t comp2 = tempVal1.compare(tempKey00);
                        if (comp2 == 0){
                            for (unsigned i = 2; i < tempVal00.size(); i++) {
                                v2.push_back(tempVal00[i-2]);
                                v2.push_back(tempVal00[i-1]);
                                v2.push_back(tempVal00[i]);
                            }
                        }

                    }   
                    }     

            }
        }


    }
}

What am I missing??

  • 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-24T03:01:21+00:00Added an answer on May 24, 2026 at 3:01 am
    std::map<string, vector<float>> d;
    std::map<string, string> d1;
    std::map<vector<float>, vector<float>> d2;
    
    // Fill the maps here
    
    for(std::map<string, string>::iterator i = d1.begin(); i != d1.end(); i++) {
        d2[d[i->first]] = d[i->second];
    }
    

    This is a fairly trivial operation with a basic working knowledge of the C++ Standard library. How you intend on comparing a vector of floats, I’m not wholly sure. C++ does not have a comparator for a vector of floats by default.

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

Sidebar

Related Questions

this kind of follows on from another question of mine. Basically, once I have
I know questions of this kind have been asked before, but my situation differs
I have ask this kind of question before, but it seems my previous question
I have this kind of code in some applications (from microsoft) [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage( Microsoft.Naming,
I know this kind of questions have been asked already many times before. The
I am sure that this kind of questions must have been asked before, but
I have this kind of node in my xml document: <parent ...> <a .../>
I have this kind of table for simple chat: messages table structure +----+---------+-----------+---------+------+------+ |
Please help me understand the meaning of this code. I have seen this kind
I have this kind of array: $a = array( 'one' => 'one', '0' =>

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.