记录详情

Compile Error

foo.cc: In member function 'void SeqList::remove(int)':
foo.cc:22:42: error: cannot convert 'std::vector<int>::iterator' to 'const char*'
   22 |         data.erase(std::remove(data.begin(), data.end(), value), data.end());
      |                                ~~~~~~~~~~^~
      |                                          |
      |                                          std::vector<int>::iterator
In file included from /nix/gcc-13.2.0/include/c++/13.2.0/cstdio:42,
                 from /nix/gcc-13.2.0/include/c++/13.2.0/ext/string_conversions.h:45,
                 from /nix/gcc-13.2.0/include/c++/13.2.0/bits/basic_string.h:4097,
                 from /nix/gcc-13.2.0/include/c++/13.2.0/string:54,
                 from /nix/gcc-13.2.0/include/c++/13.2.0/bits/locale_classes.h:40,
                 from /nix/gcc-13.2.0/include/c++/13.2.0/bits/ios_base.h:41,
                 from /nix/gcc-13.2.0/include/c++/13.2.0/ios:44,
                 from /nix/gcc-13.2.0/include/c++/13.2.0/ostream:40,
                 from iostream:41:
/nix/glibc-2.38-44-dev/include/stdio.h:157:32: note:   initializing argument 1 of 'int remove(const char*)'
  157 | extern int remove (const char *__filename) __THROW;
      |                    ~~~~~~~~~~~~^~~~~~~~~~
foo.cc: In member function 'void SeqList::print() const':
foo.cc:27:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |         for (int i = 0; i < data.size(); ++i) {
      |                         ~~^~~~~~~~~~~~~
foo.cc: In function 'int main()':
foo.cc:48:14: error: 'std::vector<int> SeqList::data' is private within this context
   48 |         list.data[i] = value;
      |              ^~~~
foo.cc:7:22: note: declared private here
    7 |     std::vector<int> data;
      |                      ^~~~

信息

递交者
类型
自测
题目
P1014 OO3-1 无序顺序表类的基本运算
语言
C++
递交时间
2024-03-18 22:43:53
评测时间
2024-03-18 22:43:53
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes