#include <map>
#include <list>
int main() {
std::map<int, std::list<int> > myMap;
// infinite loop, should be std::pair<int, std::list<int> >
myMap.insert(std::pair<int, int>(4, 5));
return 0;
}
I2luY2x1ZGUgPG1hcD4KI2luY2x1ZGUgPGxpc3Q+CgppbnQgbWFpbigpIHsKICAgIHN0ZDo6bWFwPGludCwgc3RkOjpsaXN0PGludD4gPiBteU1hcDsKICAgIC8vIGluZmluaXRlIGxvb3AsIHNob3VsZCBiZSBzdGQ6OnBhaXI8aW50LCBzdGQ6Omxpc3Q8aW50PiA+CiAgICBteU1hcC5pbnNlcnQoc3RkOjpwYWlyPGludCwgaW50Pig0LCA1KSk7CgogICAgcmV0dXJuIDA7Cn0=
prog.cpp: In function ‘int main()’:
prog.cpp:7:43: error: no matching function for call to ‘std::map<int, std::list<int> >::insert(std::pair<int, int>)’
prog.cpp:7:43: note: candidates are:
In file included from /usr/include/c++/4.7/map:61:0,
from prog.cpp:1:
/usr/include/c++/4.7/bits/stl_map.h:522:7: note: std::pair<typename std::_Rb_tree<_Key, std::pair<const _Key, _Tp>, std::_Select1st<std::pair<const _Key, _Tp> >, _Compare, typename _Alloc::rebind<std::map<_Key, _Tp, _Compare, _Alloc>::value_type>::other>::iterator, bool> std::map<_Key, _Tp, _Compare, _Alloc>::insert(const value_type&) [with _Key = int; _Tp = std::list<int>; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, std::list<int> > >; typename std::_Rb_tree<_Key, std::pair<const _Key, _Tp>, std::_Select1st<std::pair<const _Key, _Tp> >, _Compare, typename _Alloc::rebind<std::map<_Key, _Tp, _Compare, _Alloc>::value_type>::other>::iterator = std::_Rb_tree_iterator<std::pair<const int, std::list<int> > >; std::map<_Key, _Tp, _Compare, _Alloc>::value_type = std::pair<const int, std::list<int> >]
/usr/include/c++/4.7/bits/stl_map.h:522:7: note: no known conversion for argument 1 from ‘std::pair<int, int>’ to ‘const value_type& {aka const std::pair<const int, std::list<int> >&}’
/usr/include/c++/4.7/bits/stl_map.h:530:9: note: template<class _Pair, class> std::pair<typename std::_Rb_tree<_Key, std::pair<const _Key, _Tp>, std::_Select1st<std::pair<const _Key, _Tp> >, _Compare, typename _Alloc::rebind<std::map<_Key, _Tp, _Compare, _Alloc>::value_type>::other>::iterator, bool> std::map::insert(_Pair&&) [with _Pair = _Pair; <template-parameter-2-2> = <template-parameter-1-2>; _Key = int; _Tp = std::list<int>; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, std::list<int> > >]
/usr/include/c++/4.7/bits/stl_map.h:530:9: note: template argument deduction/substitution failed:
/usr/include/c++/4.7/bits/stl_map.h:526:32: error: no type named ‘type’ in ‘struct std::enable_if<false, void>’
/usr/include/c++/4.7/bits/stl_map.h:543:7: note: void std::map<_Key, _Tp, _Compare, _Alloc>::insert(std::initializer_list<std::pair<const _Key, _Tp> >) [with _Key = int; _Tp = std::list<int>; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, std::list<int> > >]
/usr/include/c++/4.7/bits/stl_map.h:543:7: note: no known conversion for argument 1 from ‘std::pair<int, int>’ to ‘std::initializer_list<std::pair<const int, std::list<int> > >’
/usr/include/c++/4.7/bits/stl_map.h:572:7: note: std::map<_Key, _Tp, _Compare, _Alloc>::iterator std::map<_Key, _Tp, _Compare, _Alloc>::insert(std::map<_Key, _Tp, _Compare, _Alloc>::const_iterator, const value_type&) [with _Key = int; _Tp = std::list<int>; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, std::list<int> > >; std::map<_Key, _Tp, _Compare, _Alloc>::iterator = std::_Rb_tree_iterator<std::pair<const int, std::list<int> > >; std::map<_Key, _Tp, _Compare, _Alloc>::const_iterator = std::_Rb_tree_const_iterator<std::pair<const int, std::list<int> > >; std::map<_Key, _Tp, _Compare, _Alloc>::value_type = std::pair<const int, std::list<int> >]
/usr/include/c++/4.7/bits/stl_map.h:572:7: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/4.7/bits/stl_map.h:583:9: note: template<class _Pair, class> std::map<_Key, _Tp, _Compare, _Alloc>::iterator std::map::insert(std::map<_Key, _Tp, _Compare, _Alloc>::const_iterator, _Pair&&) [with _Pair = _Pair; <template-parameter-2-2> = <template-parameter-1-2>; _Key = int; _Tp = std::list<int>; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, std::list<int> > >]
/usr/include/c++/4.7/bits/stl_map.h:583:9: note: template argument deduction/substitution failed:
prog.cpp:7:43: note: cannot convert ‘std::pair<int, int>((* &4), (* &5))’ (type ‘std::pair<int, int>’) to type ‘std::map<int, std::list<int> >::const_iterator {aka std::_Rb_tree_const_iterator<std::pair<const int, std::list<int> > >}’
In file included from /usr/include/c++/4.7/map:61:0,
from prog.cpp:1:
/usr/include/c++/4.7/bits/stl_map.h:598:9: note: template<class _InputIterator> void std::map::insert(_InputIterator, _InputIterator) [with _InputIterator = _InputIterator; _Key = int; _Tp = std::list<int>; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, std::list<int> > >]
/usr/include/c++/4.7/bits/stl_map.h:598:9: note: template argument deduction/substitution failed:
prog.cpp:7:43: note: candidate expects 2 arguments, 1 provided