here is my code snippet...
'''
#include<bits/stdc++.h>
using namespace std;
int main()
{
map<pair<int ,int>, int> m;
m[{1,2}]=1;
cout<<m[{1,2}];
// map<pair<int,int>,pair<int,int> > k;
// k[{2,3}]=make_pair(1,2);
// cout<<k[{2,3}];
map<int,pair<int,int> > s;
s[12]={1,23};
cout<<s[12]<<endl;
}
'''
now when I tried to bind pair to int it worked fine .. but when I reversed it and tried to bind int with pair<int,int> it failed.. and is giving the error
13 11 D:\dec\cf\Untitled2.cpp [Error] cannot bind 'std::ostream {aka std::basic_ostream}' lvalue to 'std::basic_ostream&&'
39 0 D:\dev c++\Dev-Cpp\MinGW64\lib\gcc\x86_64-w64-mingw32\4.9.2\include\c++\istream In file included from D:/dev c++/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++/istream
38 D:\dev c++\Dev-Cpp\MinGW64\lib\gcc\x86_64-w64-mingw32\4.9.2\include\c++\sstream from D:/dev c++/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++/sstream
45 D:\dev c++\Dev-Cpp\MinGW64\lib\gcc\x86_64-w64-mingw32\4.9.2\include\c++\complex from D:/dev c++/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++/complex
38 D:\dev c++\Dev-Cpp\MinGW64\lib\gcc\x86_64-w64-mingw32\4.9.2\include\c++\ccomplex from D:/dev c++/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++/ccomplex
52 D:\dev c++\Dev-Cpp\MinGW64\lib\gcc\x86_64-w64-mingw32\4.9.2\include\c++\x86_64-w64-mingw32\bits\stdc++.h from D:/dev c++/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++/x86_64-w64-mingw32/bits/stdc++.h
Now can anyone tell me why this is happening and what different I can do to to handle situations where I need to bind int with pair of ints like in directed graph and traverse peacefully.
Also I also tried s[12].first/s[12]->first but it didnt work.