pushback to a vector in a map<int, vector>

I have a map <int, vector<object>>, and I want to push back an object to an instance of vector[int]. But I get the error no matching function, here is the sample code.
I use c++11 and windows.

1
2
3
4
5
6
7
8
9
10
11
12

    map<int, vector<Objects>> map_segments;
    vector<Objects>           vec_objects;

    ClassA objects;
    for(auto it=objects.begin(); it!=objects.end(); it++){
        int value = it->value;
        /// error is here, no matching function
        map_segments.insert(pair<int, vector<Objects>>
        (value, (vec_objects[value]).push_back(*it)));
    }
The return type of push_back(...) is void hence you cannot use it like so.

1
2
3
4
5
6
7
8
9
10
    map<int, vector<Objects>> map_segments;
    vector<Objects>           vec_objects;

    ClassA objects;
    for(auto it=objects.begin(); it!=objects.end(); it++){
        int value = it->value;
        vec_objects.push_back(*it); // push_back here
        map_segments.insert(pair<int, vector<Objects>>
        (value, vec_objects); // insert the vec_objects
    }
Topic archived. No new replies allowed.