rope

时间:2021-03-06 15:01:46   收藏:0   阅读:0

rope (类似于块状链表的结构)

需要增加的预处理指令:
#include<ext/rope>
using namespace __gnu_cxx;
rope<int> rp;

基本操作:
在末尾插入 \(x\) : rp.push_back(x);
\(pos\) 处插入 \(x\) : rp.insert(pos, x);
\(pos\) 处开始删除 \(x\) 个元素: rp.erase(pos, x);
返回 \(rp\) 的大小: rp.length();rp.size();
\(pos\) 处的元素替换成 \(x\): rp.replace(pos, x);
获取从 \(pos\) 处开始的 \(x\) 个元素: rp.substr(pos, x);
将从 \(pos\) 处开始的 \(x\) 个元素复制到 \(s\) 中: rp.copy(pos, x, s);
访问第 \(x\) 个元素: rp[x];rp.at(x);

拷贝历史版本:
rope<int> *his[1000];
his[i] = new rope<int> (*his[i - 1]);

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!