Compile Error

/in/foo.cc: In function 'int compare(std::string, std::string)':
/in/foo.cc:18:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |     for (int i = 0; i < a.size(); ++i) {
      |                     ~~^~~~~~~~~~
/in/foo.cc: In function 'int main()':
/in/foo.cc:75:10: error: no match for 'operator==' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'char')
   75 |     if(N =='1')
      |        ~ ^~~~~
      |        |   |
      |        |   char
      |        std::string {aka std::__cxx11::basic_string<char>}
In file included from /usr/include/c++/12/regex:66,
                 from /usr/include/x86_64-linux-gnu/c++/12/bits/stdc++.h:110,
                 from /in/foo.cc:1:
/usr/include/c++/12/bits/regex.h:1063:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
 1063 |     operator==(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
      |     ^~~~~~~~
/usr/include/c++/12/bits/regex.h:1063:5: note:   template argument deduction/substitution failed:
/in/foo.cc:75:12: note:   'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
   75 |     if(N =='1')
      |            ^~~
/usr/include/c++/12/bits/regex.h:1159:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)'
 1159 |     operator==(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/12/bits/regex.h:1159:5: note:   template argument deduction/substitution failed:
/in/foo.cc:75:12: note:   mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'char'
   75 |     if(N =='1')
      |            ^~~
/usr/include/c++/12/bits/regex.h:1234:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)'
 1234 |     operator==(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/12/bits/regex.h:1234:5: note:   template argument deduction/substitution failed:
/in/foo.cc:75:12: note:   'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
   75 |     if(N =='1')
      |            ^~~
/usr/include/c++/12/bits/regex.h:1326:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
 1326 |     operator==(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
      |     ^~~~~~~~
/usr/include/c++/12/bits/regex.h:1326:5: note:   template argument deduction/substitution failed:
/in/foo.cc:75:12: note:   mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'char'
   75 |     if(N =='1')
      |            ^~~
/usr/include/c++/12/bits/regex.h:1401:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
 1401 |     operator==(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/12/bits/regex.h:1401:5: note:   template argument deduction/substitution failed:
/in/foo.cc:75:12: note:   'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
   75 |     if(N =='1')
      |            ^~~
/usr/include/c++/12/bits/regex.h:1494:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
 1494 |     operator==(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
      |     ^~~~~~~~
/usr/include/c++/12/bits/regex.h:1494:5: note:   template argument deduction/substitution failed:
/in/foo.cc:75:12: note:   mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'char'
   75 |     if(N =='1')
      |            ^~~
/usr/include/c++/12/bits/regex.h:1573:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
 1573 |     operator==(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/12/bits/regex.h:1573:5: note:   template argument deduction/substitution failed:
/in/foo.cc:75:12: note:   'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
   75 |     if(N =='1')
      |            ^~~
/usr/include/c++/12/bits/regex.h:2131:5: note: candidate: 'template<class _Bi_iter, class _Alloc> bool std::__cxx11::operator==(const match_results<_BiIter, _Alloc>&, const match_results<_BiIter, _Alloc>&)'
 2131 |     operator==(const match_results<_Bi_iter, _Alloc>& __m1,
      |     ^~~~~~~~
/usr/include/c++/12/bits/regex.h:2131:5: note:   template argument deduction/substitution failed:
/in/foo.cc:75:12: note:   'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::match_results<_BiIter, _Alloc>'
   75 |     if(N =='1')
      |            ^~~
In file included from /usr/include/c++/12/iosfwd:40,
                 from /usr/include/c++/12/ios:38,
                 from /usr/include/c++/12/istream:38,
                 from /usr/include/c++/12/sstream:38,
                 from /usr/include/c++/12/complex:45,
                 from /usr/include/c++/12/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/12/bits/stdc++.h:54:
/usr/include/c++/12/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)'
  192 |     operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
      |     ^~~~~~~~
/usr/include/c++/12/bits/postypes.h:192:5: note:   template argument deduction/substitution failed:
/in/foo.cc:75:12: note:   'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::fpos<_StateT>'
   75 |     if(N =='1')
      |            ^~~
In file included from /usr/include/c++/12/string:41,
                 from /usr/include/c++/12/bits/locale_classes.h:40,
                 from /usr/include/c++/12/bits/ios_base.h:41,
                 from /usr/include/c++/12/ios:42:
/usr/include/c++/12/bits/allocator.h:219:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)'
  219 |     operator==(const allocator<_T1>&, const allocator<_T2>&)
      |     ^~~~~~~~
/usr/include/c++/12/bits/allocator.h:219:5: note:   template argument deduction/substitution failed:
/in/foo.cc:75:12: note:   'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::allocator<_CharT>'
   75 |     if(N =='1')
      |            ^~~
In file included from /usr/include/c++/12/string:47:
/usr/include/c++/12/bits/stl_iterator.h:444:5: note: candidate: 'template<class _Iterator> bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
  444 |     operator==(const reverse_iterator<_Iterator>& __x,
      |     ^~~~~~~~
/usr/include/c++/12/bits/stl_iterator.h:444:5: note:   template argument deduction/substitution failed:
/in/foo.cc:75:12: note:   'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
   75 |     if(N =='1')
      |            ^~~
/usr/include/c++/12/bits/stl_iterator.h:489:5: note: candidate: 'template<class _IteratorL, class _IteratorR> bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
  489 |     operator==(const reverse_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/12/bits/stl_iterator.h:489:5: note:   template argument deduction/substitution failed:
/in/foo.cc:75:12: note:   'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 

信息

递交者
类型
递交
题目
P2681 spring
语言
C++
递交时间
2025-10-07 17:26:33
评测时间
2025-10-07 17:26:33
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes