fork download
  1. #include<map>
  2. #include<iostream>
  3. int main() {
  4. int a = 5, b = 7;
  5. auto pair = std::make_pair<int, int>(a,b);
  6. return 0;
  7. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:5:45: error: no matching function for call to ‘make_pair(int&, int&)’
prog.cpp:5:45: note: candidate is:
In file included from /usr/include/c++/4.7/bits/stl_algobase.h:65:0,
                 from /usr/include/c++/4.7/bits/stl_tree.h:63,
                 from /usr/include/c++/4.7/map:60,
                 from prog.cpp:1:
/usr/include/c++/4.7/bits/stl_pair.h:268:5: note: template<class _T1, class _T2> constexpr std::pair<typename std::__decay_and_strip<_T1>::__type, typename std::__decay_and_strip<_T2>::__type> std::make_pair(_T1&&, _T2&&)
/usr/include/c++/4.7/bits/stl_pair.h:268:5: note:   template argument deduction/substitution failed:
prog.cpp:5:45: note:   cannot convert ‘a’ (type ‘int’) to type ‘int&&’
prog.cpp:5:45: error: unable to deduce ‘auto’ from ‘<expression error>’
prog.cpp:5:10: warning: unused variable ‘pair’ [-Wunused-variable]
stdout
Standard output is empty