记录详情

Compile Error

foo.cc: In member function 'PolyListNode& PolyListNode::operator=(PolyListNode&)':
foo.cc:16:77: warning: no return statement in function returning non-void [-Wreturn-type]
   16 |  PolyListNode & operator = (PolyListNode &x){ coe = x.coe; index = x.index; }
      |                                                                             ^
      |                                                                             return *this;
foo.cc: In constructor 'PolyList::PolyList(int)':
foo.cc:31:6: warning: 'PolyList::n' will be initialized after [-Wreorder]
   31 |  int n;    //数量
      |      ^
foo.cc:30:6: warning:   'int PolyList::size' [-Wreorder]
   30 |  int size;   //有效范围
      |      ^~~~
foo.cc:33:2: warning:   when initialized here [-Wreorder]
   33 |  PolyList(int n = 0):n(n),size(1){ a =new PolyListNode[size]; }
      |  ^~~~~~~~
foo.cc: In copy constructor 'PolyList::PolyList(const PolyList&)':
foo.cc:31:6: warning: 'PolyList::n' will be initialized after [-Wreorder]
   31 |  int n;    //数量
      |      ^
foo.cc:30:6: warning:   'int PolyList::size' [-Wreorder]
   30 |  int size;   //有效范围
      |      ^~~~
foo.cc:34:2: warning:   when initialized here [-Wreorder]
   34 |  PolyList(const PolyList &p):n(0),size(1){a =new PolyListNode[size];*this = p; }
      |  ^~~~~~~~
In file included from /usr/include/c++/9/algorithm:62,
                 from foo.cc:6:
/usr/include/c++/9/bits/stl_algo.h: In instantiation of 'void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = PolyListNode*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(PolyListNode&, PolyListNode&)>]':
/usr/include/c++/9/bits/stl_algo.h:1890:25:   required from 'void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = PolyListNode*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(PolyListNode&, PolyListNode&)>]'
/usr/include/c++/9/bits/stl_algo.h:1976:31:   required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = PolyListNode*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(PolyListNode&, PolyListNode&)>]'
/usr/include/c++/9/bits/stl_algo.h:4905:18:   required from 'void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = PolyListNode*; _Compare = bool (*)(PolyListNode&, PolyListNode&)]'
foo.cc:104:17:   required from here
/usr/include/c++/9/bits/stl_algo.h:1855:3: error: cannot bind non-const lvalue reference of type 'PolyListNode&' to an rvalue of type 'std::remove_reference<PolyListNode&>::type' {aka 'PolyListNode'}
 1855 |   __val = _GLIBCXX_MOVE(*__i);
      |   ^~~~~
foo.cc:15:30: note:   initializing argument 1 of 'PolyListNode::PolyListNode(PolyListNode&)'
   15 |  PolyListNode (PolyListNode &x){ coe = x.coe; index = x.index;  }
      |                ~~~~~~~~~~~~~~^
In file included from /usr/include/c++/9/algorithm:62,
                 from foo.cc:6:
/usr/include/c++/9/bits/stl_algo.h:1857:17: error: cannot bind non-const lvalue reference of type 'PolyListNode&' to an rvalue of type 'std::remove_reference<PolyListNode&>::type' {aka 'PolyListNode'}
 1857 |        *__first = _GLIBCXX_MOVE(__val);
      |                 ^
foo.cc:16:43: note:   initializing argument 1 of 'PolyListNode& PolyListNode::operator=(PolyListNode&)'
   16 |  PolyListNode & operator = (PolyListNode &x){ coe = x.coe; index = x.index; }
      |                             ~~~~~~~~~~~~~~^
In file included from /usr/include/c++/9/bits/stl_algo.h:61,
                 from /usr/include/c++/9/algorithm:62,
                 from foo.cc:6:
/usr/include/c++/9/bits/stl_heap.h: In instantiation of 'void std::__make_heap(_RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = PolyListNode*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(PolyListNode&, PolyListNode&)>]':
/usr/include/c++/9/bits/stl_algo.h:1677:23:   required from 'void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = PolyListNode*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(PolyListNode&, PolyListNode&)>]'
/usr/include/c++/9/bits/stl_algo.h:1938:25:   required from 'void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = PolyListNode*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(PolyListNode&, PolyListNode&)>]'
/usr/include/c++/9/bits/stl_algo.h:1953:27:   required from 'void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = PolyListNode*; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(PolyListNode&, PolyListNode&)>]'
/usr/include/c++/9/bits/stl_algo.h:1973:25:   required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = PolyListNode*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(PolyListNode&, PolyListNode&)>]'
/usr/include/c++/9/bits/stl_algo.h:4905:18:   required from 'void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = PolyListNode*; _Compare = bool (*)(PolyListNode&, PolyListNode&)]'
foo.cc:104:17:   required from here
/usr/include/c++/9/bits/stl_heap.h:341:15: error: cannot bind non-const lvalue reference of type 'PolyListNode&' to an rvalue of type 'std::remove_reference<PolyListNode&>::type' {aka 'PolyListNode'}
  341 |    _ValueType __value = _GLIBCXX_MOVE(*(__first + __parent));
      |               ^~~~~~~
foo.cc:15:30: note:   initializing argument 1 of 'PolyListNode::PolyListNode(PolyListNode&)'
   15 |  PolyListNode (PolyListNode &x){ coe = x.coe; index = x.index;  }
      |                ~~~~~~~~~~~~~~^
In file included from /usr/include/c++/9/bits/stl_algo.h:61,
                 from /usr/include/c++/9/algorithm:62,
                 from foo.cc:6:
/usr/include/c++/9/bits/stl_heap.h:342:22: error: cannot bind non-const lvalue reference of type 'PolyListNode&' to an rvalue of type 'std::remove_reference<PolyListNode&>::type' {aka 'PolyListNode'}
  342 |    std::__adjust_heap(__first, __parent, __len, _GLIBCXX_MOVE(__value),
      |    ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  343 |         __comp);
      |         ~~~~~~~       
foo.cc:15:30: note:   initializing argument 1 of 'PolyListNode::PolyListNode(PolyListNode&)'
   15 |  PolyListNode (PolyListNode &x){ coe = x.coe; index = x.index;  }
      |                ~~~~~~~~~~~~~~^
In file included from /usr/include/c++/9/bits/stl_algo.h:61,
                 from /usr/include/c++/9/algorithm:62,
                 from foo.cc:6:
/usr/include/c++/9/bits/stl_heap.h:215:26: note:   initializing argument 4 of 'void std::__adjust_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare) [with _RandomAccessIterator = PolyListNode*; _Distance = long int; _Tp = PolyListNode; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(PolyListNode&, PolyListNode&)>]'
  215 |     _Distance __len, _Tp __value, _Compare __comp)
      |                      ~~~~^~~~~~~
/usr/include/c++/9/bits/stl_heap.h: In instantiation of 'void std::__pop_heap(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = PolyListNode*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(PolyListNode&, PolyListNode&)>]':
/usr/include/c++/9/bits/stl_algo.h:1680:19:   required from 'void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = PolyListNode*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(PolyListNode&, PolyListNode&)>]'
/usr/include/c++/9/bits/stl_algo.h:1938:25:   required from 'void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = PolyListNode*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(PolyListNode&, PolyListNode&)>]'
/usr/include/c++/9/bits/stl_algo.h:1953:27:   required from 'void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = PolyListNode*; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(PolyListNode&, PolyListNode&)>]'
/usr/include/c++/9/bits/stl_algo.h:1973:25:   required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = PolyListNode*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(PolyListNode&, PolyListNode&)>]'
/usr/include/c++/9/bits/stl_algo.h:4905:18:   required from 'void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = PolyListNode*; _Compare = bool (*)(PolyListNode&, PolyListNode&)]'
foo.cc:104:17:   required from here
/usr/include/c++/9/bits/stl_heap.h:251:18: error: cannot bind non-const lvalue reference of type 'PolyListNode&' to an rvalue of type 'std::remove_reference<PolyListNode&>::type' {aka 'PolyListNode'}
  251 |       _ValueType __value = _GLIBCXX_MOVE(*__result);
      |                  ^~~~~~~
foo.cc:15:30: note:   initializing argument 1 of 'PolyListNode::PolyListNode(PolyListNode&)'
   15 |  PolyListNode (PolyListNode &x){ coe = x.coe; index = x.index;  }
      |                ~~~~~~~~~~~~~~^
In file included from /usr/include/c++/9/bits/stl_algo.h:61,
                 from /usr/include/c++/9/algorithm:62,
                 from foo.cc:6:
/usr/include/c++/9/bits/stl_heap.h:252:17: error: cannot bind non-const lvalue reference of type 'PolyListNode&' to an rvalue of type 'std::remove_reference<PolyListNode&>::type' {aka 'PolyListNode'}
  252 |       *__result = _GLIBCXX_MOVE(*__first);
      |                 ^
foo.cc:16:43: note:   initializing argument 1 of 'PolyListNode& PolyListNode::operator=(PolyListNode&)'
   16 |  PolyListNode & operator = (PolyListNode &x){ coe = x.coe; index = x.index; }
      |                             ~~~~~~~~~~~~~~^
In file included from /usr/include/c++/9/bits/stl_algo.h:61,
                 from /usr/include/c++/9/algorithm:62,
                 from foo.cc:6:
/usr/include/c++/9/bits/stl_heap.h:253:25: error: cannot bind non-const lvalue reference of type 'PolyListNode&' to an rvalue of type 'std::remove_reference<PolyListNode&>::type' {aka 'PolyListNode'}
  253 |       std::__adjust_heap(__first, _DistanceType(0),
      |       ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
  254 |     _DistanceType(__last - __first),
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  255 |     _GLIBCXX_MOVE(__value), __comp);
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
foo.cc:15:30: note:   initializing argument 1 of 'PolyListNode::PolyListNode(PolyListNode&)'
   15 |  PolyListNode (PolyListNode &x){ coe = x.coe; index = x.index;  }
      |                ~~~~~~~~~~~~~~^
In file included from /usr/include/c++/9/bits/stl_algo.h:61,
                 from /usr/include/c++/9/algorithm:62,
                 from foo.cc:6:
/usr/include/c++/9/bits/stl_heap.h:215:26: note:   initializing argument 4 of 'void std::__adjust_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare) [with _RandomAccessIterator = PolyListNode*; _Distance = long int; _Tp = PolyListNode; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(PolyListNode&, PolyListNode&)>]'
  215 |     _Distance __len, _Tp __value, _Compare __comp)
      |                      ~~~~^~~~~~~
In file included from /usr/include/c++/9/bits/char_traits.h:39,
                 from /usr/include/c++/9/ios:40,
                 from /usr/include/c++/9/ostream:38,
                 from /usr/include/c++/9/iostream:39,
                 from foo.cc:4:
/usr/include/c++/9/bits/stl_algobase.h: In instantiation of 'void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 = PolyListNode*; _ForwardIterator2 = PolyListNode*]':
/usr/include/c++/9/bits/stl_algo.h:84:20:   required from 'void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator = PolyListNode*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(PolyListNode&, PolyListNode&)>]'
/usr/include/c++/9/bits/stl_algo.h:1926:34:   required from '_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = PolyListNode*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(PolyListNode&, PolyListNode&)>]'
/usr/include/c++/9/bits/stl_algo.h:1958:38:   required from 'void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = PolyListNode*; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(PolyListNode&, PolyListNode&)>]'
/usr/include/c++/9/bits/stl_algo.h:1973:25:   required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = PolyListNode*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(PolyListNode&, PolyListNode&)>]'
/usr/include/c++/9/bits/stl_algo.h:4905:18:   required from 'void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = PolyListNode*; _Compare = bool (*)(PolyListNode&, PolyListNode&)]'
foo.cc:104:17:   required from here
/usr/include/c++/9/bits/stl_algobase.h:151:11: error: no matching function for call to 'swap(PolyListNode&, PolyListNode&)'
  151 |       swap(*__a, *__b);
      |       ~~~~^~~~~~~~~~~~
In file included 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:4:
/usr/include/c++/9/bits/move.h:182:5: note: candidate: 'template<class _Tp> typename std::enable_if<std::__and_<std::__not_<std::__is_tuple_like<_Tp> >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> >::value>::type std::swap(_Tp&, _Tp&)'
  182 |     swap(_Tp& __a, _Tp& __b)
      |     ^~~~
/usr/include/c++/9/bits/move.h:182:5: note:   template argument deduction/substitution failed:
/usr/include/c++/9/bits/move.h: In substitution of 'template<class _Tp> typename std::enable_if<std::__and_<std::__not_<std::__is_tuple_like<_Tp> >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> >::value>::type std::swap(_Tp&, _Tp&) [with _Tp = PolyListNode]':
/usr/include/c++/9/bits/stl_algobase.h:151:11:   required from 'void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 = PolyListNode*; _ForwardIterator2 = PolyListNode*]'
/usr/include/c++/9/bits/stl_algo.h:84:20:   required from 'void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator = PolyListNode*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(PolyListNode&, PolyListNode&)>]'
/usr/include/c++/9/bits/stl_algo.h:1926:34:   required from '_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = PolyListNode*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(PolyListNode&, PolyListNode&)>]'
/usr/include/c++/9/bits/stl_algo.h:1958:38:   required from 'void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = PolyListNode*; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(PolyListNode&, PolyListNode&)>]'
/usr/include/c++/9/bits/stl_algo.h:1973:25:   required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = PolyListNode*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(PolyListNode&, PolyListNode&)>]'
/usr/include/c++/9/bits/stl_algo.h:4905:18:   required from 'void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = PolyListNode*; _Compare = bool (*)(PolyListNode&, PolyListNode&)]'
foo.cc:104:17:   required from here
/usr/include/c++/9/bits/move.h:182:5: error: no type named 'type' in 'struct std::enable_if<false, void>'
/usr/include/c++/9/bits/stl_algobase.h: In instantiation of 'void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 = PolyListNode*; _ForwardIterator2 = PolyListNode*]':
/usr/include/c++/9/bits/stl_algo.h:84:20:   required from 'void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator = PolyListNode*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(PolyListNode&, PolyListNode&)>]'
/usr/include/c++/9/bits/stl_algo.h:1926:34:   required from '_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = PolyListNode*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(PolyListNode&, PolyListNode&)>]'
/usr/include/c++/9/bits/stl_algo.h:1958:38:   required from 'void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = PolyListNode*; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(PolyListNode&, PolyListNode&)>]'
/usr/include/c++/9/bits/stl_algo.h:1973:25:   required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = PolyListNode*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(PolyListNode&, PolyListNode&)>]'
/usr/include/c++/9/bits/stl_algo.h:4905:18:   required from 'void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = PolyListNode*; _Compare = bool (*)(PolyListNode&, PolyListNode&)]'
foo.cc:104:17:   required from here
/usr/include/c++/9/bits/move.h:205:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> typename std::enable_if<std::__is_swappable<_Tp>::value>::type std::swap(_Tp (&)[_Nm], _Tp (&)[_Nm])'
  205 |     swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])
      |     ^~~~
/usr/include/c++/9/bits/move.h:205:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/9/bits/char_traits.h:39,
                 from /usr/include/c++/9/ios:40,
                 from /usr/include/c++/9/ostream:38,
                 from /usr/include/c++/9/iostream:39,
                 from foo.cc:4:
/usr/include/c++/9/bits/stl_algobase.h:151:11: note:   mismatched types '_Tp [_Nm]' and 'PolyListNode'
  151 |       swap(*__a, *__b);
      |       ~~~~^~~~~~~~~~~~
In file included from /usr/include/c++/9/bits/stl_algobase.h:64,
                 from /usr/include/c++/9/bits/char_traits.h:39,
                 from /usr/include/c++/9/ios:40,
                 from /usr/include/c++/9/ostream:38,
                 from /usr/include/c++/9/iostream:39,
                 from foo.cc:4:
/usr/include/c++/9/bits/stl_pair.h:495:5: note: candidate: 'template<class _T1, class _T2> void std::swap(std::pair<_T1, _T2>&, std::pair<_T1, _T2>&)'
  495 |     swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y)
      |     ^~~~
/usr/include/c++/9/bits/stl_pair.h:495:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/9/bits/char_traits.h:39,
                 from /usr/include/c++/9/ios:40,
                 from /usr/include/c++/9/ostream:38,
                 from /usr/include/c++/9/iostream:39,
                 from foo.cc:4:
/usr/include/c++/9/bits/stl_algobase.h:151:11: note:   'PolyListNode' is not derived from 'std::pair<_T1, _T2>'
  151 |       swap(*__a, *__b);
      |       ~~~~^~~~~~~~~~~~
[Hydro](https://hydro.ac)提供评测服务

信息

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