Skip to content

Commit

Permalink
update documents
Browse files Browse the repository at this point in the history
  • Loading branch information
gongluck committed Apr 23, 2022
1 parent d5a2d50 commit 4c2f47b
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 88 deletions.
30 changes: 10 additions & 20 deletions stl/README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,20 @@
# STL标准模板库

- [STL标准模板库](#stl标准模板库)
- [分配器```allocator```](#分配器allocator)
- [迭代器```iterator```](#迭代器iterator)
- [容器```container```](#容器container)
- [函数对象```functor```](#函数对象functor)
- [适配器```adapter```](#适配器adapter)
- [分配器allocator](#分配器allocator)
- [迭代器iterator](#迭代器iterator)
- [容器container](#容器container)
- [函数对象functor](#函数对象functor)
- [适配器adapter](#适配器adapter)

![STL六大模块](https://github.com/gongluck/images/blob/main/stl/STL六大模块.png)

## 分配器```allocator```
## [分配器allocator](./allocator.md)

[分配器```allocator```](./allocator.md)
## [迭代器iterator](./iterator.md)

## 迭代器```iterator```
## [容器container](./container.md)

[迭代器```iterator```](./iterator.md)
## [函数对象functor](./functor.md)

## 容器```container```

[容器```container```](./container.md)

## 函数对象```functor```

[函数对象```functor```](./functor.md)

## 适配器```adapter```

[适配器```adapter```](./adapter.md)
## [适配器adapter](./adapter.md)
42 changes: 21 additions & 21 deletions stl/adapter.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# 适配器```adapter```
# 适配器adapter

- [适配器```adapter```](#适配器adapter)
- [适配器adapter](#适配器adapter)
- [容器适配器](#容器适配器)
- [容器适配器```stack```](#容器适配器stack)
- [容器适配器```queue```](#容器适配器queue)
- [容器适配器```priority_queue```](#容器适配器priority_queue)
- [容器适配器stack](#容器适配器stack)
- [容器适配器queue](#容器适配器queue)
- [容器适配器priority_queue](#容器适配器priority_queue)
- [迭代器适配器](#迭代器适配器)
- [插入迭代器```insert iterator```](#插入迭代器insert-iterator)
- [反向迭代器```reverse iterator```](#反向迭代器reverse-iterator)
- [流迭代器```steam iterator```](#流迭代器steam-iterator)
- [插入迭代器insert iterator](#插入迭代器insert-iterator)
- [反向迭代器reverse iterator](#反向迭代器reverse-iterator)
- [流迭代器steam iterator](#流迭代器steam-iterator)
- [函数适配器](#函数适配器)

## 容器适配器

### 容器适配器```stack```
### 容器适配器stack

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

Expand All @@ -22,7 +22,7 @@
<details>
<summary>stack</summary>

```c++
```C++
//
#ifndef __STL_LIMITED_DEFAULT_TEMPLATES
template <class T, class Sequence = deque<T>>
Expand Down Expand Up @@ -66,7 +66,7 @@
```
</details>
### 容器适配器```queue```
### 容器适配器queue
队列```queue```只在尾部对元素做增操作和头部做删除,满足的底层容器有```deque```和```list```。(```vector```没有```pop_front```,即使有也会相当低效!)
Expand All @@ -75,7 +75,7 @@
<details>
<summary>queue</summary>
```c++
```C++
//队列
template <class T, class Sequence = deque<T>>
class queue
Expand Down Expand Up @@ -117,7 +117,7 @@
```
</details>

### 容器适配器```priority_queue```
### 容器适配器priority_queue

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

Expand All @@ -126,7 +126,7 @@
<details>
<summary>priority_queue</summary>

```c++
```C++
//优先队列
template <class T, class Sequence = vector<T>,
class Compare = less<typename Sequence::value_type>>
Expand Down Expand Up @@ -189,14 +189,14 @@
## 迭代器适配器
### 插入迭代器```insert iterator```
### 插入迭代器insert iterator
[stl_iterator.h](https://github.com/gongluck/sourcecode/blob/main/stl/stl_iterator.h)
<details>
<summary>insert iterator</summary>
```c++
```C++
//尾部插入迭代器
template <class Container>
class back_insert_iterator
Expand Down Expand Up @@ -308,14 +308,14 @@
```
</details>

### 反向迭代器```reverse iterator```
### 反向迭代器reverse iterator

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

<details>
<summary>reverse iterator</summary>

```c++
```C++
template <class BidirectionalIterator, class T, class Reference = T &,
class Distance = ptrdiff_t>
//反向双向迭代器
Expand Down Expand Up @@ -520,14 +520,14 @@
```
</details>
### 流迭代器```steam iterator```
### 流迭代器steam iterator
[stl_iterator.h](https://github.com/gongluck/sourcecode/blob/main/stl/stl_iterator.h)
<details>
<summary>steam iterator</summary>
```c++
```C++
//输入流迭代器
template <class T, class Distance = ptrdiff_t>
class istream_iterator
Expand Down Expand Up @@ -629,7 +629,7 @@
<details>
<summary>function adapter</summary>

```c++
```C++
//一元非
template <class Predicate>
class unary_negate
Expand Down
22 changes: 11 additions & 11 deletions stl/allocator.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# 分配器```allocator```
# 分配器allocator

- [分配器```allocator```](#分配器allocator)
- [分配器allocator](#分配器allocator)
- [标准分配器](#标准分配器)
- [```SGI```特殊分配器](#sgi特殊分配器)
- [SGI特殊分配器](#sgi特殊分配器)
- [构造和析构工具](#构造和析构工具)
- [内存分配和释放](#内存分配和释放)
- [内存基本处理工具](#内存基本处理工具)
Expand All @@ -18,7 +18,7 @@
<details>
<summary>标准分配器</summary>

```c++
```C++
//包装::operator new
template <class T>
inline T *allocate(ptrdiff_t size, T *)
Expand Down Expand Up @@ -55,7 +55,7 @@
```
</details>
## ```SGI```特殊分配器
## SGI特殊分配器
### 构造和析构工具
Expand All @@ -67,7 +67,7 @@
<details>
<summary>构造和析构工具</summary>
```c++
```C++
//销毁实例 调用析构
template <class T>
inline void destroy(T *pointer)
Expand Down Expand Up @@ -128,7 +128,7 @@
<details>
<summary>第一级配置器</summary>

```c++
```C++
//第一级分配器 包装malloc和free
template <int inst>
class __malloc_alloc_template
Expand All @@ -155,7 +155,7 @@
<details>
<summary>第二级配置器</summary>

```c++
```C++
//第二级分配器 使用内存池优化 现代malloc库和操作系统的内存api已经存在类似的内存池优化了,所以使用STL标准分配器即可。
template <bool threads, int inst>
class __default_alloc_template
Expand Down Expand Up @@ -242,7 +242,7 @@
<details>
<summary>封装分配器</summary>
```c++
```C++
//对分配器简单封装,以元素字节大小为单位分配内存
template <class T, class Alloc>
class simple_alloc
Expand Down Expand Up @@ -278,7 +278,7 @@
<details>
<summary>uninitialized_copy</summary>

```c++
```C++
// Valid if copy construction is equivalent to assignment, and if the
// destructor is trivial.
template <class InputIterator, class ForwardIterator>
Expand Down Expand Up @@ -345,7 +345,7 @@
<details>
<summary>uninitialized_fill</summary>
```c++
```C++
// Valid if copy construction is equivalent to assignment, and if the
// destructor is trivial.
template <class ForwardIterator, class T>
Expand Down
Loading

0 comments on commit 4c2f47b

Please sign in to comment.