lundi 28 mars 2016

C++ error: map.insert(make_pair(struct, vector

The following code that is a part of a chess game im making where the key are the position of the piece and the value is the possible movements that piece have

#include<iostream>
#include<map>
#include<vector>

using namespace std;

struct Coordinate{
    int x, y;
};

int main(){
    map<Coordinate, vector<Coordinate>> movements;//map that have an struct as key and a vector of structs as value.
    //There is the error
    movements.insert(make_pair(Coordinate{0,0},//the struct
                               vector<Coordinate>{Coordinate{1,1},//the vector
                                                 Coordinate{2,2},
                                                 Coordinate{3,3}}));
    return 0;
};

Thos code gets me to the line 235 in file 'stl_function.h'

Aucun commentaire:

Enregistrer un commentaire