
STL
ForBestSelf
后端开发程序猿养成中
展开
-
STL之list简要实现
(1)内存模型及实现接口(2) 源代码及简要注释sort性能比较低,对100万条随机数据排序要140秒左右,原版list的sort算法仅要1.4秒#ifndef TINY_LIST#include <memory>namespace tiny_stl{ //注意:此tiny_list有四种insert版本 //其中 //te...原创 2020-04-29 17:06:14 · 255 阅读 · 1 评论 -
STL之deque简要实现
(1)内存模型及实现接口(2)源代码及简要注释push_back、pop_back、push_front、pop_front性能和原版deque相当,insert性能慢1倍#ifndef TINY_DEQUE#include <memory>#include <cmath>#include <cstring>name...原创 2020-04-27 21:01:35 · 543 阅读 · 0 评论 -
STL之vector的简要实现
(1)内存模型及所实现的操作(2)源代码,附简要注释#ifndef TINY_VECTOR#include <memory>namespace tiny_stl{ template <typename T, typename U = std::allocator<T> > class tiny_vector //用指针表示...原创 2020-04-27 14:06:18 · 243 阅读 · 0 评论