jeudi 18 août 2016

unordered_map with tuple as key and unordered_set as value

I defined the object tuple and a Point data-structure as follows:

typedef pair<double, double> slopeIntercept;

typedef struct Point {
int x;
int y;
Point(): x(0), y(0) {}
Point(int a, int b): x(a), y(b) {}
}Point;

Now, let us employ these objects to initialize an unordered_map in C++11

void foo(){ unordered_map<slopeInter , unordered_set<Point>> slopeCount; }

The above initialization of unordered_map causes a compile time error screenshot here.

Aucun commentaire:

Enregistrer un commentaire