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?
Comments
Post a Comment