Compile Error

/in/foo.cc: In function 'bool abc(std::string)':
/in/foo.cc:6:13: error: expected unqualified-id before 'sizeof'
    6 |     int a=x.sizeof()-1,b=0,c=0;
      |             ^~~~~~
/in/foo.cc:7:18: error: no match for 'operator<=' (operand types are 'int' and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
    7 |     for(int i=0;i<=x;i++){
      |                 ~^~~
      |                 |  |
      |                 |  std::string {aka std::__cxx11::basic_string<char>}
      |                 int
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:1114:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator<=(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
 1114 |     operator<=(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
      |     ^~~~~~~~
/usr/include/c++/12/bits/regex.h:1114:5: note:   template argument deduction/substitution failed:
/in/foo.cc:7:20: note:   mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
    7 |     for(int i=0;i<=x;i++){
      |                    ^
/usr/include/c++/12/bits/regex.h:1220: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>&)'
 1220 |     operator<=(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/12/bits/regex.h:1220:5: note:   template argument deduction/substitution failed:
/in/foo.cc:7:20: note:   mismatched types 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' and 'int'
    7 |     for(int i=0;i<=x;i++){
      |                    ^
/usr/include/c++/12/bits/regex.h:1313: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>&)'
 1313 |     operator<=(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/12/bits/regex.h:1313:5: note:   template argument deduction/substitution failed:
/in/foo.cc:7:20: note:   mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
    7 |     for(int i=0;i<=x;i++){
      |                    ^
/usr/include/c++/12/bits/regex.h:1387:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<=(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
 1387 |     operator<=(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
      |     ^~~~~~~~
/usr/include/c++/12/bits/regex.h:1387:5: note:   template argument deduction/substitution failed:
/in/foo.cc:7:20: note:   'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
    7 |     for(int i=0;i<=x;i++){
      |                    ^
/usr/include/c++/12/bits/regex.h:1481:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<=(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
 1481 |     operator<=(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/12/bits/regex.h:1481:5: note:   template argument deduction/substitution failed:
/in/foo.cc:7:20: note:   mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
    7 |     for(int i=0;i<=x;i++){
      |                    ^
/usr/include/c++/12/bits/regex.h:1559:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<=(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
 1559 |     operator<=(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
      |     ^~~~~~~~
/usr/include/c++/12/bits/regex.h:1559:5: note:   template argument deduction/substitution failed:
/in/foo.cc:7:20: note:   'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
    7 |     for(int i=0;i<=x;i++){
      |                    ^
/usr/include/c++/12/bits/regex.h:1659:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<=(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
 1659 |     operator<=(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/12/bits/regex.h:1659:5: note:   template argument deduction/substitution failed:
/in/foo.cc:7:20: note:   mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
    7 |     for(int i=0;i<=x;i++){
      |                    ^
In file included from /usr/include/c++/12/string:47,
                 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,
                 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/stl_iterator.h:472:5: note: candidate: 'template<class _Iterator> bool std::operator<=(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
  472 |     operator<=(const reverse_iterator<_Iterator>& __x,
      |     ^~~~~~~~
/usr/include/c++/12/bits/stl_iterator.h:472:5: note:   template argument deduction/substitution failed:
/in/foo.cc:7:20: note:   mismatched types 'const std::reverse_iterator<_Iterator>' and 'int'
    7 |     for(int i=0;i<=x;i++){
      |                    ^
/usr/include/c++/12/bits/stl_iterator.h:516:5: note: candidate: 'template<class _IteratorL, class _IteratorR> bool std::operator<=(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
  516 |     operator<=(const reverse_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/12/bits/stl_iterator.h:516:5: note:   template argument deduction/substitution failed:
/in/foo.cc:7:20: note:   mismatched types 'const std::reverse_iterator<_Iterator>' and 'int'
    7 |     for(int i=0;i<=x;i++){
      |                    ^
/usr/include/c++/12/bits/stl_iterator.h:1693:5: note: candidate: 'template<class _IteratorL, class _IteratorR> bool std::operator<=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
 1693 |     operator<=(const move_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/12/bits/stl_iterator.h:1693:5: note:   template argument deduction/substitution failed:
/in/foo.cc:7:20: note:   mismatched types 'const std::move_iterator<_IteratorL>' and 'int'
    7 |     for(int i=0;i<=x;i++){
      |                    ^
/usr/include/c++/12/bits/stl_iterator.h:1755:5: note: candidate: 'template<class _Iterator> bool std::operator<=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
 1755 |     operator<=(const move_iterator<_Iterator>& __x,
      |     ^~~~~~~~
/usr/include/c++/12/bits/stl_iterator.h:1755:5: note:   template argument deduction/substitution failed:
/in/foo.cc:7:20: note:   mismatched types 'const std::move_iterator<_IteratorL>' and 'int'
    7 |     for(int i=0;i<=x;i++){
      |                    ^
In file included from /usr/include/c++/12/bits/stl_algobase.h:64,
                 from /usr/include/c++/12/string:50:
/usr/include/c++/12/bits/stl_pair.h:682:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<=(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
  682 |     operator<=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
      |     ^~~~~~~~
/usr/include/c++/12/bits/stl_pair.h:682:5: note:   template argument deduction/substitution failed:
/in/foo.cc:7:20: note:   mismatched types 'const std::pair<_T1, _T2>' and 'int'
    7 |     for(int i=0;i<=x;i++){
      |                    ^
In file included from /usr/include/c++/12/string:53:
/usr/include/c++/12/bits/basic_string.h:3767:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<=(const __cxx11::ba

信息

递交者
类型
递交
题目
P2968 规范的 IP 地址
语言
C++
递交时间
2025-10-06 10:10:39
评测时间
2025-10-06 10:10:39
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes