Skip to content

Commit

Permalink
stl
Browse files Browse the repository at this point in the history
  • Loading branch information
gongluck committed Feb 18, 2023
1 parent 274f74f commit 681e07d
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 23 deletions.
22 changes: 11 additions & 11 deletions stl/adapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
- [容器适配器](#容器适配器)
- [容器适配器stack](#容器适配器stack)
- [容器适配器queue](#容器适配器queue)
- [容器适配器priority_queue](#容器适配器priority_queue)
- [容器适配器priority\_queue](#容器适配器priority_queue)
- [迭代器适配器](#迭代器适配器)
- [插入迭代器insert iterator](#插入迭代器insert-iterator)
- [反向迭代器reverse iterator](#反向迭代器reverse-iterator)
Expand All @@ -15,9 +15,9 @@

### 容器适配器stack

```stack```只在尾部对元素做增删操作,满足的底层容器有```vector``````deque``````list```
`stack`只在尾部对元素做增删操作,满足的底层容器有`vector``deque``list`

[stl_stack.h](https://github.com/gongluck/sourcecode/blob/main/stl/stl_stack.h)
[stl_stack.h](https://github.com/gongluck/sourcecode/blob/main/stl/stl_stack.h#L36)

<details>
<summary>stack</summary>
Expand Down Expand Up @@ -68,9 +68,9 @@
### 容器适配器queue
队列```queue```只在尾部对元素做增操作和头部做删除,满足的底层容器有```deque```和```list```。(```vector```没有```pop_front```,即使有也会相当低效!)
队列`queue`只在尾部对元素做增操作和头部做删除,满足的底层容器有`deque`和`list`。(`vector`没有`pop_front`,即使有也会相当低效!)
[stl_queue.h](https://github.com/gongluck/sourcecode/blob/main/stl/stl_queue.h)
[stl_queue.h](https://github.com/gongluck/sourcecode/blob/main/stl/stl_queue.h#L36)
<details>
<summary>queue</summary>
Expand Down Expand Up @@ -119,9 +119,9 @@

### 容器适配器priority_queue

优先队列```priority_queue```底层依赖``````实现。
优先队列`priority_queue`底层依赖``实现。

[stl_queue.h](https://github.com/gongluck/sourcecode/blob/main/stl/stl_queue.h)
[stl_queue.h](https://github.com/gongluck/sourcecode/blob/main/stl/stl_queue.h#L79)

<details>
<summary>priority_queue</summary>
Expand Down Expand Up @@ -191,7 +191,7 @@
### 插入迭代器insert iterator
[stl_iterator.h](https://github.com/gongluck/sourcecode/blob/main/stl/stl_iterator.h)
[stl_iterator.h](https://github.com/gongluck/sourcecode/blob/main/stl/stl_iterator.h#L381)
<details>
<summary>insert iterator</summary>
Expand Down Expand Up @@ -310,7 +310,7 @@

### 反向迭代器reverse iterator

[stl_iterator.h](https://github.com/gongluck/sourcecode/blob/main/stl/stl_iterator.h)
[stl_iterator.h](https://github.com/gongluck/sourcecode/blob/main/stl/stl_iterator.h#L526)

<details>
<summary>reverse iterator</summary>
Expand Down Expand Up @@ -522,7 +522,7 @@
### 流迭代器steam iterator
[stl_iterator.h](https://github.com/gongluck/sourcecode/blob/main/stl/stl_iterator.h)
[stl_iterator.h](https://github.com/gongluck/sourcecode/blob/main/stl/stl_iterator.h#L914)
<details>
<summary>steam iterator</summary>
Expand Down Expand Up @@ -624,7 +624,7 @@

## 函数适配器

[stl_function.h](https://github.com/gongluck/sourcecode/blob/main/stl/stl_function.h)
[stl_function.h](https://github.com/gongluck/sourcecode/blob/main/stl/stl_function.h#L166)

<details>
<summary>function adapter</summary>
Expand Down
22 changes: 11 additions & 11 deletions stl/allocator.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@

## 标准分配器

包装```::operator new``````::operator delete```
包装`::operator new``::operator delete`

![标准分配器](https://github.com/gongluck/images/blob/main/stl/标准分配器.png)

[defalloc.h](https://github.com/gongluck/sourcecode/blob/main/stl/defalloc.h)
[defalloc.h](https://github.com/gongluck/sourcecode/blob/main/stl/defalloc.h#L35)

<details>
<summary>标准分配器</summary>
Expand Down Expand Up @@ -59,10 +59,10 @@
### 构造和析构工具
```construct```利用```placement new```实现。
```destroy```调用析构函数或者利用```萃取特性```进而调用遍历析构或者特化的版本。
`construct`利用`placement new`实现。
`destroy`调用析构函数或者利用`萃取特性`进而调用遍历析构或者特化的版本。
[stl_construct.h](https://github.com/gongluck/sourcecode/blob/main/stl/stl_construct.h)
[stl_construct.h](https://github.com/gongluck/sourcecode/blob/main/stl/stl_construct.h#L38)
<details>
<summary>构造和析构工具</summary>
Expand Down Expand Up @@ -120,10 +120,10 @@

![内存池分配器](https://github.com/gongluck/images/blob/main/stl/内存池分配器.png)

[stl_alloc.h](https://github.com/gongluck/sourcecode/blob/main/stl/stl_alloc.h)
[stl_alloc.h](https://github.com/gongluck/sourcecode/blob/main/stl/stl_alloc.h#L143)

```SGI```设计了双层策略。
第一级配置器```__malloc_alloc_template```简单包装了```malloc``````free```,并在内存分配失败时调用失败处理函数。
`SGI`设计了双层策略。
第一级配置器`__malloc_alloc_template`简单包装了`malloc``free`,并在内存分配失败时调用失败处理函数。

<details>
<summary>第一级配置器</summary>
Expand All @@ -150,7 +150,7 @@
```
</details>

第二级配置器```__default_alloc_template```使用了```内存池```策略,使用```free list```实现。第二级配置器的内存池实现是```双缓冲```,内存池不足时先从侯备缓存中分配,当侯备缓存也不能分配才从系统中申请。
第二级配置器`__default_alloc_template`使用了`内存池`策略,使用`free list`实现。第二级配置器的内存池实现是`双缓冲`,内存池不足时先从侯备缓存中分配,当侯备缓存也不能分配才从系统中申请。

<details>
<summary>第二级配置器</summary>
Expand Down Expand Up @@ -271,9 +271,9 @@

## 内存基本处理工具

```uninitialized_copy``````uninitialized_fill```在目标内存调用拷贝构造函数或者内存拷贝函数。
`uninitialized_copy``uninitialized_fill`在目标内存调用拷贝构造函数或者内存拷贝函数。

[stl_uninitialized.h](https://github.com/gongluck/sourcecode/blob/main/stl/stl_uninitialized.h)
[stl_uninitialized.h](https://github.com/gongluck/sourcecode/blob/main/stl/stl_uninitialized.h#L36)

<details>
<summary>uninitialized_copy</summary>
Expand Down
2 changes: 1 addition & 1 deletion stl/functor.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

## 标准库函数对象

[stl_function.h](https://github.com/gongluck/sourcecode/blob/main/stl/stl_function.h)
[stl_function.h](https://github.com/gongluck/sourcecode/blob/main/stl/stl_function.h#L36)

<details>
<summary>标准库函数对象</summary>
Expand Down

0 comments on commit 681e07d

Please sign in to comment.