帮忙看看模板类到底哪里出错了

qq459673705 qq459673705 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
#include <string>
#include <iostream>

using namespace std;
template<typename T>
void rtrim(basic_string<T>& s,T c)
{
if(s.empty())
return;

typename basic_string<T>::iterator p;
for(p=s.end();p!=s.begin()&&*--p==c;);
if(*p!=c)
p++;
s.erase(p,s.end());
}
int main()
{
string s="Great!!!!!";
wstring ws=L"super!!!!";

rtrim(s,'!');
rtrim(ws,L"!");

cout<<s<<'\n';
wcout<<ws<<L'\n';
}
总是提示;

22.cpp:23: error: no matching function for call to ‘rtrim(std::wstring&, const wchar_t [2])’
实在找不到问题所在了,
谢谢!
...全文

相关推荐

评论 5
收藏 已收藏
分享
返回顶部
qq459673705
C++ 语言 65,212 成员 250,513 内容