Compile Error

/in/foo.cc: In function 'int main()':
/in/foo.cc:6:24: error: expected primary-expression before ')' token
    6 |         getline(cin,s,!);
      |                        ^
/in/foo.cc:7:31: error: no matching function for call to 'end()'
    7 |         revers(s.begin(),s,end());
      |                            ~~~^~
In file included from /usr/include/c++/12/bits/range_access.h:36,
                 from /usr/include/c++/12/string:52,
                 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,
                 from /in/foo.cc:1:
/usr/include/c++/12/initializer_list:101:5: note: candidate: 'template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)'
  101 |     end(initializer_list<_Tp> __ils) noexcept
      |     ^~~
/usr/include/c++/12/initializer_list:101:5: note:   template argument deduction/substitution failed:
/in/foo.cc:7:31: note:   candidate expects 1 argument, 0 provided
    7 |         revers(s.begin(),s,end());
      |                            ~~~^~
/usr/include/c++/12/bits/range_access.h:74:5: note: candidate: 'template<class _Container> decltype (__cont.end()) std::end(_Container&)'
   74 |     end(_Container& __cont) -> decltype(__cont.end())
      |     ^~~
/usr/include/c++/12/bits/range_access.h:74:5: note:   template argument deduction/substitution failed:
/in/foo.cc:7:31: note:   candidate expects 1 argument, 0 provided
    7 |         revers(s.begin(),s,end());
      |                            ~~~^~
/usr/include/c++/12/bits/range_access.h:85:5: note: candidate: 'template<class _Container> decltype (__cont.end()) std::end(const _Container&)'
   85 |     end(const _Container& __cont) -> decltype(__cont.end())
      |     ^~~
/usr/include/c++/12/bits/range_access.h:85:5: note:   template argument deduction/substitution failed:
/in/foo.cc:7:31: note:   candidate expects 1 argument, 0 provided
    7 |         revers(s.begin(),s,end());
      |                            ~~~^~
/usr/include/c++/12/bits/range_access.h:106:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> _Tp* std::end(_Tp (&)[_Nm])'
  106 |     end(_Tp (&__arr)[_Nm]) noexcept
      |     ^~~
/usr/include/c++/12/bits/range_access.h:106:5: note:   template argument deduction/substitution failed:
/in/foo.cc:7:31: note:   candidate expects 1 argument, 0 provided
    7 |         revers(s.begin(),s,end());
      |                            ~~~^~
In file included from /usr/include/x86_64-linux-gnu/c++/12/bits/stdc++.h:95:
/usr/include/c++/12/valarray:1237:5: note: candidate: 'template<class _Tp> _Tp* std::end(valarray<_Tp>&)'
 1237 |     end(valarray<_Tp>& __va) noexcept
      |     ^~~
/usr/include/c++/12/valarray:1237:5: note:   template argument deduction/substitution failed:
/in/foo.cc:7:31: note:   candidate expects 1 argument, 0 provided
    7 |         revers(s.begin(),s,end());
      |                            ~~~^~
/usr/include/c++/12/valarray:1253:5: note: candidate: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)'
 1253 |     end(const valarray<_Tp>& __va) noexcept
      |     ^~~
/usr/include/c++/12/valarray:1253:5: note:   template argument deduction/substitution failed:
/in/foo.cc:7:31: note:   candidate expects 1 argument, 0 provided
    7 |         revers(s.begin(),s,end());
      |                            ~~~^~
/in/foo.cc:7:9: error: 'revers' was not declared in this scope
    7 |         revers(s.begin(),s,end());
      |         ^~~~~~

信息

递交者
类型
自测
题目
P2531 字符串逆序
语言
C++
递交时间
2026-11-28 14:56:14
评测时间
2026-11-28 14:56:14
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes