samedi 28 juillet 2018

How to redefine a pair in c++ [duplicate]

This question already has an answer here:

I am working a lot with pairs in c++ these days so I want to do next:

Instead of:

pair<int, int> p;
cin >> p.first >> p.second;

I want to write:

pair<int, int> p;
cin >> p.x >> p.y;

I tried #define first x and similar things but it doesn't work. How to redefine this?

Aucun commentaire:

Enregistrer un commentaire