types - Frustrated when creating a pair of integers in C++ -


this question has answer here:

i want create pair in c++

int x=3; int y =4; std::pair<int,int> mypair = std::make_pair<int,int>(x,y); 

but error:

 error: no matching function call ‘make_pair(int&, int&)’      std::pair<int,int> mypair = std::make_pair<int,int>(x,y); 

on other hand, if use

std::pair<int,int> mypair = std::make_pair<int,int>(3,4); 

then works. explanation on ths? , how make first case above work 1 can create pair (x,y) wihtout pain?

change to:

std::pair<int,int> mypair = std::make_pair(x,y); 

explanation here


Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -