Rope用法
头文件:#include<ext/rope>
声明:using namespace __gnu_cxx;
定义:crope x;
函数:
x.push_back(ch) 在末尾添加字符ch
x.insert(pos,s) 在pos位置插入字符ch
x.erase(pos,x) 从pos位置开始删除x个
x.replace(pos,ch) 将位置为pos的字符换成ch
x.substr(pos,x) 从pos位置开始提取x个字符
x.copy(pos,x,s) 将从pos位置开始x个字符提取到s中
#include<ext/rope>
#include<cstdio>
using namespace std;
using namespace __gnu_cxx;
crope x;
char s[10000000];
int main(){
x.insert(0,"233");
x.erase(1,1);//23
x.replace(1,"!");//2!
x.push_back('1');//2!1
x.insert(2,"&^");//2!&^1
x.copy(0,5,s);
printf("%s",s);//2!&^1
}
评论 (0)