65,211
社区成员
发帖
与我相关
我的任务
分享
#include<queue>
using namespace std;
class my_queue:public queue<string>
{
......
friend ostream & operator<<(ostream &out,const string &in)
{
push_back(in);//这样效率更高一些,你那样的话,动态分配很浪费的。而且封装性不太好;这样会好很多的。
}
.....
}
ostream& operator <<(ostream& (the name you need), const String &str)
ostream& operator <<(ostream&os ,const String &str)
{
string* str = new string;
str->push_back("Test");
str->push_back(loc_nMd5);
push(str);
}
obj& operator <<(obj&..what name ,const String &str)
{
string* str = new string;
str->push_back("Test");
str->push_back(loc_nMd5);
push(str);
}