string的assign操作

insulted 2008-11-17 06:11:33
#include <string>
#include <iostream>

using namespace std;

int main()
{
string quote1( "When lilacs last in the dooryard bloom'd" );
string quote2( "The child is in father of the man" );

string sentence;
sentence.assgin(quote2.c_str(), 13);

cout<< sentence <<endl;
return 0;
}


问什么编译器总是说:
'struct std::string' has no member named 'assgin' !
gcc和vc6,7都是这么说,我在vc6下还引用了“STL-port5.15”呢!
...全文
484 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
Non_Recursive 2008-11-17
  • 打赏
  • 举报
回复
assign
insulted 2008-11-17
  • 打赏
  • 举报
回复
hqin老大就是快啊!
感觉您好像是online all the time!
分是您的莫属了!
谢谢!
太乙 2008-11-17
  • 打赏
  • 举报
回复
basic_string::assign
basic_string& assign(const E *s);
basic_string& assign(const E *s, size_type n);
basic_string& assign(const basic_string& str,
size_type pos, size_type n);
basic_string& assign(const basic_string& str);
basic_string& assign(size_type n, E c);
basic_string& assign(const_iterator first, const_iterator last);
Each member function replaces the sequence controlled by *this with the operand sequence, then returns *this.

In this implementation, if a translator does not support member template functions, the template:

template<class InIt>
basic_string& assign(InIt first, InIt last);
is replaced by:

basic_string& assign(const_iterator first, const_iterator last);
太乙 2008-11-17
  • 打赏
  • 举报
回复
写错了,是assign

33,311

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 新手乐园
社区管理员
  • 新手乐园社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧