<?xml version="1.0" encoding="utf-8" ?><rss version="2.0"><channel><title><![CDATA[Scostifile的博客]]></title><description><![CDATA[]]></description><link>https://blog.youkuaiyun.com/Scostifile</link><language>zh-cn</language><generator>https://blog.youkuaiyun.com/</generator><copyright><![CDATA[Copyright &copy; Scostifile]]></copyright><item><title><![CDATA[数据结构--Tire树]]></title><link>https://blog.youkuaiyun.com/Scostifile/article/details/123462104</link><guid>https://blog.youkuaiyun.com/Scostifile/article/details/123462104</guid><author>Scostifile</author><pubDate>Sun, 13 Mar 2022 18:36:00 +0800</pubDate><description><![CDATA[实现一个Trie树一、Trie树的基本操作二、代码实现
一、Trie树的基本操作
(1) 插入字符串
(2) 搜索目标字符串
(3) 搜索以目标字符串为前缀的情况是否存在
二、代码实现
class Trie{
public:
	class TrieNode{
	public:
		TireNode(char data){
			this-&gt;data = data;
			this-&gt;children.assign(26, nullptr);
		}
	public:
		char data;
	]]></description><category></category></item><item><title><![CDATA[数据结构--链表]]></title><link>https://blog.youkuaiyun.com/Scostifile/article/details/123412726</link><guid>https://blog.youkuaiyun.com/Scostifile/article/details/123412726</guid><author>Scostifile</author><pubDate>Thu, 10 Mar 2022 22:53:22 +0800</pubDate><description><![CDATA[实现一个链表一、链表的基本操作二、代码实现
一、链表的基本操作
(1) 遍历(统计链表长度)
(2) 查找链表中某元素
(3) 在链表中插入某节点

a. 链表头插入
b. 链表尾插入
c.给定节点之后插入

(4) 在链表中删除某结点

a. 删除给定结点之后的结点
b. 删除给定结点（并返回删除后的链表的头结点）

二、代码实现
class MyList{
public:
	class Node{
	public:
		Node(int data){
			this-&gt;value = data;
]]></description><category></category></item><item><title><![CDATA[浅撕实现一个类的底层内存池]]></title><link>https://blog.youkuaiyun.com/Scostifile/article/details/123386807</link><guid>https://blog.youkuaiyun.com/Scostifile/article/details/123386807</guid><author>Scostifile</author><pubDate>Wed, 09 Mar 2022 22:36:25 +0800</pubDate><description><![CDATA[实现针对类的内存池一、内存池的概念和实现原理概述“内存池”，要解决什么问题？“内存池”的实现原理二：针对一个类的内存池的实现代码三、内存池代码的改进嵌入式指针(embedded pointer)专门的内存池类
一、内存池的概念和实现原理概述
malloc：内存浪费，频繁分配小块内存，则浪费更加显得明显。
“内存池”，要解决什么问题？
(1)减少malloc的次数，减少malloc()调用次数就意味着减少对内存的浪费；
(2)减少malloc的调用次数，是否能够提高程序运行效率？ 会有一些速度和效率上的提升，]]></description><category></category></item><item><title><![CDATA[C++ 内存管理（四）----非标准库下的allocator]]></title><link>https://blog.youkuaiyun.com/Scostifile/article/details/117780357</link><guid>https://blog.youkuaiyun.com/Scostifile/article/details/117780357</guid><author>Scostifile</author><pubDate>Thu, 10 Jun 2021 15:54:02 +0800</pubDate><description><![CDATA[C++ 内存管理（四）----非标准库下的allocator一、array_allocator二、bitmap_allocator
一、array_allocator
由其构造函数array_allocator()知，因为必须传入指针参数，所以传入指针参数的默认值必须赋值，即默认赋空值。
以下操作与上操作相同，只是定义对象时方式不同，实际意义相同：

二、bitmap_allocator



用完了第一个super-blocks，则创建第二个super-blocks时，blocks的数量按第一个block]]></description><category></category></item><item><title><![CDATA[C++ 内存管理（三）----Loki allocator]]></title><link>https://blog.youkuaiyun.com/Scostifile/article/details/117717272</link><guid>https://blog.youkuaiyun.com/Scostifile/article/details/117717272</guid><author>Scostifile</author><pubDate>Wed, 09 Jun 2021 22:52:24 +0800</pubDate><description><![CDATA[C++ 内存管理（三）----Loki allocator一、上中下三个classes
一、上中下三个classes

最表层的struct SmallObjAllocator:
1.FixedAllocator类型指针 pLastAlloc和 pLastDealloc分别指向其内部存放的首个元素[FixedAllocator类对象]的首地址 和 末尾元素[FixedAllocator类对象]的地址的下一个位置；
2.chunkSize为指定chunk的内存大小
class FixedAllocator{
]]></description><category></category></item><item><title><![CDATA[C++ 内存管理（三）----VC6内存分配]]></title><link>https://blog.youkuaiyun.com/Scostifile/article/details/117619887</link><guid>https://blog.youkuaiyun.com/Scostifile/article/details/117619887</guid><author>Scostifile</author><pubDate>Tue, 08 Jun 2021 18:56:34 +0800</pubDate><description><![CDATA[C++ 内存管理（三）----VC6内存分配一、源码- _heap_init() 和 _sbh_heap_init()- _ioinit()- _heap_alloc_dbg()- _heap_alloc_base()二、SBH行为分析---分配+释放图解三、分配内存归还操作系统
一、源码
代码执行次序是从下往上的，且可知在进入main程序执行之前，先执行的是mainCRTStartup的前置程序(分配内存空间)。

- _heap_init() 和 _sbh_heap_init()
_heap_init(]]></description><category></category></item><item><title><![CDATA[C++ 内存管理（二）----std::alloc]]></title><link>https://blog.youkuaiyun.com/Scostifile/article/details/117481257</link><guid>https://blog.youkuaiyun.com/Scostifile/article/details/117481257</guid><author>Scostifile</author><pubDate>Thu, 03 Jun 2021 23:20:10 +0800</pubDate><description><![CDATA[C++ 内存管理（二）----std::alloc一、std::alloc运行模式(G2.9)- 基本结构- 运行图示过程二、std::alloc 源码剖析- 第一级分配器- 第二级分配器- refill( )函数- chunk_alloc( )函数三、总结
一、std::alloc运行模式(G2.9)
- 基本结构
前面中的per-class allocator的四个版本，实现操作都是每个class里面只有专属于它的allocator，然后其里头也只维护一条free list，专门为其服务。
而std::]]></description><category></category></item><item><title><![CDATA[C++ 内存管理（一）----per-class allocator]]></title><link>https://blog.youkuaiyun.com/Scostifile/article/details/117452542</link><guid>https://blog.youkuaiyun.com/Scostifile/article/details/117452542</guid><author>Scostifile</author><pubDate>Wed, 02 Jun 2021 11:25:03 +0800</pubDate><description><![CDATA[C++ 内存管理（一）----per-class allocator一、per-class allocator 1二、per-class allocator 2
一、per-class allocator 1
想利用类内重载operator new去接管内存的分配，然后利用内存池的观念【即创建出一大段连续空间的内存，然后将其切割成一小段一小段】，将创建的元素对象放在内存池切分好的各分段小内存片中，这样避免了多次调用new而造成生成多个带有cookie的内存空间。通过内存池的观念，可以生成一大段只带有两个头尾]]></description><category></category></item><item><title><![CDATA[C++ 内存管理（一）----new/delete]]></title><link>https://blog.youkuaiyun.com/Scostifile/article/details/117430515</link><guid>https://blog.youkuaiyun.com/Scostifile/article/details/117430515</guid><author>Scostifile</author><pubDate>Tue, 01 Jun 2021 19:40:16 +0800</pubDate><description><![CDATA[C++ 内存管理（一）----new/delete一、C++程序使用memory的途径二、new/delete expression( new/delete表达式 )三、直接调用Ctor&amp;Dtor
一、C++程序使用memory的途径

一般来说user使用时都是调用标准库的std::allocator去分配内存，
而std::allocator内部是调用到了new，new[]，new()【此为placement new】，::operator new()…，
而new…这些底层则又是调用了mall]]></description><category></category></item><item><title><![CDATA[C++ STL和泛型编程（四）----movable]]></title><link>https://blog.youkuaiyun.com/Scostifile/article/details/117394963</link><guid>https://blog.youkuaiyun.com/Scostifile/article/details/117394963</guid><author>Scostifile</author><pubDate>Sun, 30 May 2021 11:55:01 +0800</pubDate><description><![CDATA[C++ STL和泛型编程（四）----movable一、moveable对各容器的影响二、moveable class三、测试函数
一、moveable对各容器的影响

其对vector的影响表现在 ctor / move ctor【因为vector存在空间不足时得重新扩展，然后再拷贝到新空间的情况，所以最终得到的vector的ctor和move ctor时间上差别明显。而其他容器的ctor和move ctor则差别不大，主要差别在copy ctor 和 move ctor】 及 copy ctor / m]]></description><category></category></item><item><title><![CDATA[C++ STL和泛型编程（四）----type traits]]></title><link>https://blog.youkuaiyun.com/Scostifile/article/details/117390806</link><guid>https://blog.youkuaiyun.com/Scostifile/article/details/117390806</guid><author>Scostifile</author><pubDate>Sat, 29 May 2021 22:24:55 +0800</pubDate><description><![CDATA[C++ STL和泛型编程（四）----type traits一、源码实现(G2.9)二、C2.0下三、type traits测试- class Foo- class Goo- class Zoo四、type traits实现- is_void- is_integral
一、源码实现(G2.9)
trivial表示平凡的，不重要的意思。

由上知，泛化版本的struct __type_traits其default_constructor，copy_constructor等等都是重要的，且都不是POD_type]]></description><category></category></item><item><title><![CDATA[C++ STL和泛型编程（四）----tuple]]></title><link>https://blog.youkuaiyun.com/Scostifile/article/details/117387401</link><guid>https://blog.youkuaiyun.com/Scostifile/article/details/117387401</guid><author>Scostifile</author><pubDate>Sat, 29 May 2021 17:07:11 +0800</pubDate><description><![CDATA[C++ STL和泛型编程（四）----tuple一、tuple用例
一、tuple用例

元组其主要操作如上所示，其里面可以放置不定量且不同类型的元素数据，底层源码实现如下（利用variadic templates）：

首先，其在这里运用的自我继承，且参数层层拆分递减【与前面的hash function通用模板的拆分递减参数调用类似，只不过这里是运用在类继承上面。而且这是C++设计模式中的一种。】，每往上继承一层对应的父类传入模板参数就被拆分少1个，一直往上继承，直到继承到base父类【此时传入模板参数为]]></description><category></category></item><item><title><![CDATA[C++ STL和泛型编程（四）----一个万用的hash function]]></title><link>https://blog.youkuaiyun.com/Scostifile/article/details/117378793</link><guid>https://blog.youkuaiyun.com/Scostifile/article/details/117378793</guid><author>Scostifile</author><pubDate>Sat, 29 May 2021 12:20:03 +0800</pubDate><description><![CDATA[C++ STL和泛型编程（三）----一个万用的hash function一、Hash Function通用版型二、实现操作三、以struct hash偏特化形式实现 Hash Function
一、Hash Function通用版型
#inlcude &lt;functional&gt;
class Customer{ // 自定义一个存放于容器的元素的类
public:
	string fname;
	string lname;
	long no;
	Customer(const string _fna]]></description><category></category></item><item><title><![CDATA[C++ STL和泛型编程（三）----适配器（Adapters）]]></title><link>https://blog.youkuaiyun.com/Scostifile/article/details/117293928</link><guid>https://blog.youkuaiyun.com/Scostifile/article/details/117293928</guid><author>Scostifile</author><pubDate>Fri, 28 May 2021 22:01:58 +0800</pubDate><description><![CDATA[C++ STL和泛型编程（三）----适配器（Adapters）一、作用及类别二、Container Adapters三、Functor Adapters- binder2nd- not1- bind四、Iterator Adapters- reverse_iterator- inserter(注意不是insert)五、X adapters- ostream_iterator
一、作用及类别
Adapter是将某个已经存在的东西改造一下，如改下接口（两个参数的改为一个参数）或改下函数名称之类的。
在编程技术]]></description><category></category></item><item><title><![CDATA[C++ STL和泛型编程（三）----仿函数Functors]]></title><link>https://blog.youkuaiyun.com/Scostifile/article/details/117280224</link><guid>https://blog.youkuaiyun.com/Scostifile/article/details/117280224</guid><author>Scostifile</author><pubDate>Wed, 26 May 2021 13:43:32 +0800</pubDate><description><![CDATA[C++ STL和泛型编程（三）----仿函数和函数对象（Functors）一、结构形式二、仿函数functors的可适配(adaptable)条件
一、结构形式
Functors是一个struct即类，里面operator()，所以最终是创建出来一个对象，而因为这个对象起到像函数的作用因而称为仿函数。其只为算法提供服务。
这里的Functors都继承了binary_function&lt;T, T, T&gt;类。
由上图左下角的Algorithm的第三传入模板参数知，其需要一种函数或仿函数去告诉它如何操作]]></description><category></category></item><item><title><![CDATA[C++ STL和泛型编程（三）---部分算法源码剖析（Algorithms)]]></title><link>https://blog.youkuaiyun.com/Scostifile/article/details/117264556</link><guid>https://blog.youkuaiyun.com/Scostifile/article/details/117264556</guid><author>Scostifile</author><pubDate>Tue, 25 May 2021 22:58:07 +0800</pubDate><description><![CDATA[C++ STL和泛型编程（三）---部分算法源码剖析一、结构形式二、算法accumulate三、算法for_each四、算法replace, replace_if, replace_copy五、算法count, count_if六、find, find_if七、算法sort八、算法binary_search九、关于reverse iterator, rbegin(), rend()
一、结构形式
template&lt;typename Iterator&gt;
std::Algorithm(Iterato]]></description><category></category></item><item><title><![CDATA[C++ STL和泛型编程（三）----迭代器的分类（category）]]></title><link>https://blog.youkuaiyun.com/Scostifile/article/details/117250857</link><guid>https://blog.youkuaiyun.com/Scostifile/article/details/117250857</guid><author>Scostifile</author><pubDate>Tue, 25 May 2021 19:03:00 +0800</pubDate><description><![CDATA[C++ STL和泛型编程（三）---迭代器的分类（category）一、迭代器的中介作用二、各种容器的iterators的iterator_category三、iterator_category对算法的影响四、算法源码中对iterator_category的“暗示”五、iterator_category和type traits对算法的影响
一、迭代器的中介作用

容器Container是class template
算法Algorithm是function template
迭代器Iterator是clas]]></description><category></category></item><item><title><![CDATA[C++ STL和泛型编程（二）---- hashtable[unordered_set&unordered_map]]]></title><link>https://blog.youkuaiyun.com/Scostifile/article/details/117223554</link><guid>https://blog.youkuaiyun.com/Scostifile/article/details/117223554</guid><author>Scostifile</author><pubDate>Tue, 25 May 2021 10:25:28 +0800</pubDate><description><![CDATA[C++ STL和泛型编程（二）---hashtable[unordered_set&amp;unordered_map]一、结构二、代码实现（G2.9）三、使用实例(G2.9)- **hash-function, hash-code**- **modulus运算**四、unordered_set, unordered_map, unordered_multiset, unordered_multimap
一、结构
hashtable称哈希表，又称散列表【因为其中当元素总数超过bucket时打散之后再排序的】]]></description><category></category></item><item><title><![CDATA[C++ STL和泛型编程（二）---- map/multimap]]></title><link>https://blog.youkuaiyun.com/Scostifile/article/details/117154857</link><guid>https://blog.youkuaiyun.com/Scostifile/article/details/117154857</guid><author>Scostifile</author><pubDate>Sat, 22 May 2021 15:18:26 +0800</pubDate><description><![CDATA[C++ STL和泛型编程（二）---- map/multimap一、map-  结构特性- 底层代码实现- G2.9中- VC6中- operator[ ] (map中独特的方式，multimap不支持)
一、map
-  结构特性
map/multimap以rb_tree为底层结构，key和data是独立分开的，其iterator可以改变data但不可改变key，所以map/multimap内部自动将user指定的key_type设定为const类型，即禁止修改元素的key值。
map中实现insert(]]></description><category></category></item><item><title><![CDATA[C++ STL和泛型编程（二）---- set/multiset]]></title><link>https://blog.youkuaiyun.com/Scostifile/article/details/117152062</link><guid>https://blog.youkuaiyun.com/Scostifile/article/details/117152062</guid><author>Scostifile</author><pubDate>Sat, 22 May 2021 11:09:11 +0800</pubDate><description><![CDATA[C++ STL和泛型编程（二）---- set/multiset一、set-  结构特性- 底层代码实现- G2.9中- VC6中二、multiset
一、set
-  结构特性
set/multiset以rb_tree为底层结构，其value和key是合二为一的即value就是key【元素里面只放一个东西】。
因为不能改变key值，所以使用的iterator是rb_tree的const iterator。
set中实现insert()操作时，调用的时rb_tree的insert_unique()；
mul]]></description><category></category></item></channel></rss>