STL - rope 【强大的字符串处理容器】

包含头文件:

#include<ext/rope>
using namespace __gnu_cxx;

申请:

 1 rope text; 

基本操作:

 1 test.push_back(x);        //在末尾添加x
 2 
 3 test.insert(pos,x);         //在pos插入x  
 4 
 5 
 6 test.erase(pos,x);          //从pos开始删除x个
 7 
 8 
 9 test.copy(pos,len,x);      //从pos开始到pos+len为止用x代替
10 
11 
12 test.replace(pos,x);        //从pos开始换成x
13 
14 
15 test.substr(pos,x);         //提取pos开始x个
16 
17 
18 test.at(x)/[x];                //访问第x个元素

 

posted @ 2018-07-31 02:16  莜莫  阅读(438)  评论(0编辑  收藏  举报