记录详情

Compile Error

foo.cc:7: warning: ignoring #pragma warning  [-Wunknown-pragmas]
    7 | #pragma warning(disable:4786)
      | 
foo.cc: In function 'void Add(std::map<int, int>&, std::map<int, int>&)':
foo.cc:23:16: error: no matching function for call to 'std::map<int, int>::insert(std::map<int, int>::iterator&)'
   23 |   M1.insert(it2);
      |                ^
In file included from /usr/include/c++/9/map:61,
                 from foo.cc:2:
/usr/include/c++/9/bits/stl_map.h:801:7: note: candidate: 'std::pair<typename std::_Rb_tree<_Key, std::pair<const _Key, _Tp>, std::_Select1st<std::pair<const _Key, _Tp> >, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<std::pair<const _Key, _Tp> >::other>::iterator, bool> std::map<_Key, _Tp, _Compare, _Alloc>::insert(const value_type&) [with _Key = int; _Tp = int; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, int> >; typename std::_Rb_tree<_Key, std::pair<const _Key, _Tp>, std::_Select1st<std::pair<const _Key, _Tp> >, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<std::pair<const _Key, _Tp> >::other>::iterator = std::_Rb_tree_iterator<std::pair<const int, int> >; std::map<_Key, _Tp, _Compare, _Alloc>::value_type = std::pair<const int, int>]'
  801 |       insert(const value_type& __x)
      |       ^~~~~~
/usr/include/c++/9/bits/stl_map.h:801:32: note:   no known conversion for argument 1 from 'std::map<int, int>::iterator' {aka 'std::_Rb_tree_iterator<std::pair<const int, int> >'} to 'const value_type&' {aka 'const std::pair<const int, int>&'}
  801 |       insert(const value_type& __x)
      |              ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/9/bits/stl_map.h:808:7: note: candidate: 'std::pair<typename std::_Rb_tree<_Key, std::pair<const _Key, _Tp>, std::_Select1st<std::pair<const _Key, _Tp> >, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<std::pair<const _Key, _Tp> >::other>::iterator, bool> std::map<_Key, _Tp, _Compare, _Alloc>::insert(std::map<_Key, _Tp, _Compare, _Alloc>::value_type&&) [with _Key = int; _Tp = int; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, int> >; typename std::_Rb_tree<_Key, std::pair<const _Key, _Tp>, std::_Select1st<std::pair<const _Key, _Tp> >, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<std::pair<const _Key, _Tp> >::other>::iterator = std::_Rb_tree_iterator<std::pair<const int, int> >; std::map<_Key, _Tp, _Compare, _Alloc>::value_type = std::pair<const int, int>]'
  808 |       insert(value_type&& __x)
      |       ^~~~~~
/usr/include/c++/9/bits/stl_map.h:808:27: note:   no known conversion for argument 1 from 'std::map<int, int>::iterator' {aka 'std::_Rb_tree_iterator<std::pair<const int, int> >'} to 'std::map<int, int>::value_type&&' {aka 'std::pair<const int, int>&&'}
  808 |       insert(value_type&& __x)
      |              ~~~~~~~~~~~~~^~~
/usr/include/c++/9/bits/stl_map.h:814:2: note: candidate: 'template<class _Pair> std::__enable_if_t<std::is_constructible<std::pair<const _Key, _Tp>, _Pair>::value, std::pair<typename std::_Rb_tree<_Key, std::pair<const _Key, _Tp>, std::_Select1st<std::pair<const _Key, _Tp> >, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<std::pair<const _Key, _Tp> >::other>::iterator, bool> > std::map<_Key, _Tp, _Compare, _Alloc>::insert(_Pair&&) [with _Pair = _Pair; _Key = int; _Tp = int; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, int> >]'
  814 |  insert(_Pair&& __x)
      |  ^~~~~~
/usr/include/c++/9/bits/stl_map.h:814:2: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/9/bits/move.h:55,
                 from /usr/include/c++/9/bits/nested_exception.h:40,
                 from /usr/include/c++/9/exception:144,
                 from /usr/include/c++/9/ios:39,
                 from /usr/include/c++/9/ostream:38,
                 from /usr/include/c++/9/iostream:39,
                 from foo.cc:1:
/usr/include/c++/9/type_traits: In substitution of 'template<bool _Cond, class _Tp> using __enable_if_t = typename std::enable_if::type [with bool _Cond = std::integral_constant<bool, false>::value; _Tp = std::pair<std::_Rb_tree_iterator<std::pair<const int, int> >, bool>]':
/usr/include/c++/9/bits/stl_map.h:814:2:   required by substitution of 'template<class _Pair> std::__enable_if_t<std::is_constructible<std::pair<const int, int>, _Pair>::value, std::pair<std::_Rb_tree_iterator<std::pair<const int, int> >, bool> > std::map<int, int>::insert<_Pair>(_Pair&&) [with _Pair = std::_Rb_tree_iterator<std::pair<const int, int> >&]'
foo.cc:23:16:   required from here
/usr/include/c++/9/type_traits:2399:11: error: no type named 'type' in 'struct std::enable_if<false, std::pair<std::_Rb_tree_iterator<std::pair<const int, int> >, bool> >'
 2399 |     using __enable_if_t = typename enable_if<_Cond, _Tp>::type;
      |           ^~~~~~~~~~~~~
In file included from /usr/include/c++/9/map:61,
                 from foo.cc:2:
/usr/include/c++/9/bits/stl_map.h:828:7: note: candidate: 'void std::map<_Key, _Tp, _Compare, _Alloc>::insert(std::initializer_list<std::pair<const _Key, _Tp> >) [with _Key = int; _Tp = int; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, int> >]'
  828 |       insert(std::initializer_list<value_type> __list)
      |       ^~~~~~
/usr/include/c++/9/bits/stl_map.h:828:48: note:   no known conversion for argument 1 from 'std::map<int, int>::iterator' {aka 'std::_Rb_tree_iterator<std::pair<const int, int> >'} to 'std::initializer_list<std::pair<const int, int> >'
  828 |       insert(std::initializer_list<value_type> __list)
      |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
/usr/include/c++/9/bits/stl_map.h:858:7: note: candidate: '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 = int; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, int> >; std::map<_Key, _Tp, _Compare, _Alloc>::iterator = std::_Rb_tree_iterator<std::pair<const int, int> >; std::map<_Key, _Tp, _Compare, _Alloc>::const_iterator = std::_Rb_tree_const_iterator<std::pair<const int, int> >; std::map<_Key, _Tp, _Compare, _Alloc>::value_type = std::pair<const int, int>]'
  858 |       insert(const_iterator __position, const value_type& __x)
      |       ^~~~~~
/usr/include/c++/9/bits/stl_map.h:858:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/9/bits/stl_map.h:868:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::iterator std::map<_Key, _Tp, _Compare, _Alloc>::insert(std::map<_Key, _Tp, _Compare, _Alloc>::const_iterator, std::map<_Key, _Tp, _Compare, _Alloc>::value_type&&) [with _Key = int; _Tp = int; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, int> >; std::map<_Key, _Tp, _Compare, _Alloc>::iterator = std::_Rb_tree_iterator<std::pair<const int, int> >; std::map<_Key, _Tp, _Compare, _Alloc>::const_iterator = std::_Rb_tree_const_iterator<std::pair<const int, int> >; std::map<_Key, _Tp, _Compare, _Alloc>::value_type = std::pair<const int, int>]'
  868 |       insert(const_iterator __position, value_type&& __x)
      |       ^~~~~~
/usr/include/c++/9/bits/stl_map.h:868:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/9/bits/stl_map.h:873:2: note: candidate: 'template<class _Pair> std::__enable_if_t<std::is_constructible<std::pair<const _Key, _Tp>, _Pair>::value, typename std::_Rb_tree<_Key, std::pair<const _Key, _Tp>, std::_Select1st<std::pair<const _Key, _Tp> >, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<std::pair<const _Key, _Tp> >::other>::iterator> std::map<_Key, _Tp, _Compare, _Alloc>::insert(std::map<_Key, _Tp, _Compare, _Alloc>::const_iterator, _Pair&&) [with _Pair = _Pair; _Key = int; _Tp = int; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, int> >]'
  873 |  insert(const_iterator __position, _Pair&& __x)
      |  ^~~~~~
/usr/include/c++/9/bits/stl_map.h:873:2: note:   template argument deduction/substitution failed:
foo.cc:23:16: note:   candidate expects 2 arguments, 1 provided
   23 |   M1.insert(it2);
      |                ^
In file included from /usr/include/c++/9/map:61,
                 from foo.cc:2:
/usr/include/c++/9/bits/stl_map.h:891:2: note: candidate: 'template<class _InputIterator> void std::map<_Key, _Tp, _Compare, _Alloc>::insert(_InputIterator, _InputIterator) [with _InputIterator = _InputIterator; _Key = int; _Tp = int; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, int> >]'
  891 |  insert(_InputIterator __first, _InputIterator __last)
      |  ^~~~~~
/usr/include/c++/9/bits/stl_map.h:891:2: note:   template argument deduction/substitution failed:
foo.cc:23:16: note:   candidate expects 2 arguments, 1 provided
   23 |   M1.insert(it2);
      |                ^
[Hydro](https://hydro.ac)提供评测服务

信息

递交者
类型
递交
题目
P1022 OO5-2 一元多项式类PolyList的运算
比赛
2022春 面向对象程序设计方法的上机作业
语言
C++
递交时间
2022-04-29 20:07:34
评测时间
2022-04-29 20:07:34
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes