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

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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T06:01:46+00:00 2026-05-29T06:01:46+00:00

I am trying to do the following std::map <int, std::vector<std::vector<double> > > mapof2Dvectors; std::vector<std::vector<double>

  • 0

I am trying to do the following

std::map <int, std::vector<std::vector<double> > > mapof2Dvectors;

std::vector<std::vector<double> > temp;
for(int u=0; u<size1; u++){
     temp.push_back( std::vector<double> ());
     temp[u].push_back(somedoublehere);
 }
 mapof2Dvectors[key].push_back(temp);

It fails when I try to compile with “error: Semantic Issue: No viable conversion from ‘std::vector >’ to ‘const value_type’ (aka ‘const std::vector >’)”

Any help would be most appreciated.

  • 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-29T06:01:47+00:00Added an answer on May 29, 2026 at 6:01 am

    Might I suggest using some typedefs? The error is actually quite simple.

    typedef std::vector<double> Vectors1d;
    typedef std::vector<VectorOfDoubles> Vectors2d;
    typedef std::map<int, Vectors2d> MapOf2dVectors;
    

    Now you’re trying to do this:

    MapOf2dVectors mapof2Dvectors;
    Vector2d temp;
    mapOf2dVectors[key].push_back(temp);
    

    Does this help spot the problem? You’re basically trying to push_back Vectors2d into a Vectors2d object when Vectors2d::push_back expects a Vectors1d object. It should be this according to your types:

    mapOf2dVectors[key] = temp;
    

    Or faster:

    mapOf2dVectors[key].swap(temp);
    

    A simple analogy of your error is like this:

    vector<int> v1;
    vector<int> v2;
    v1.push_back(v2); // error, push_back accepts only a single integer here
    

    So I’m not sure what you’re after, but it’s probably going to be either this:

    v1.insert(v1.end(), v2.begin(), v2.end());
    

    Or this:

    v1 = v2;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following cyclic dependency problem I am trying to solve: typedef std::map<int,
Can I use following syntax: std::map<int,std::list<int>> mAllData; Where Key Value(int) will be ID of
I am trying to do the following: boost::unordered_map<boost::flyweight<std::string>, boost::flyweight<std::string> > map; boost::flyweight<std::string> foo(name); map[foo]
I'm trying to iterate through a map defined as the following: std::map< size_type, std::pair<size_t,
I'm new to Ruby, and I'm trying the following: mySet = numOfCuts.times.map{ rand(seqLength) }
here is code #include <iostream> #include <map> using namespace std; int main(){ map<int ,int>a;
I am trying to use the map container in C++ in the following way:
I have a struct with a std::map of pointers inside it. I'm trying to
When I try and compile the following code... #include <vector> template <class T> void
I'm trying to get iterator for boost::fusion::map , but I'm missing something. The following

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.