STL库学习

std::string

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
struct string
{
	Union _Bxty
    {
        char _Buf[16];
        char* _Ptr;
    }
    size_t _Mysize; //字符串长度
    size_t _Myres;  //最大字符串长度
};

std::vector

1
2
3
4
5
6
struct vector
{
	T* _Myfirst; //数组起始地址
	T* _Mylast; //已使用的数组结束地址
	T* _Myend;  //最大数组结束地址
};

std::map

1
2
3
4
5
struct map
{
	Tree_nod* _MyHead;
	unsigned int _Mysize;
};

Tree_nod:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
struct Tree_nod
{
    Tree_nod* _Left;
    Tree_nod* _Parent;
    Tree_nod* _Right;
    char _Color;
    char _Isnil;
    //对齐
    map_pair _Myval; //键值对
};

std::list

1
2
3
4
5
struct list
{
	List_node* _MyHead; //list->MyHead->Next为列表第一个值
	unsigned int _Mysize;
}

List_node(大小0x8 + 值):

1
2
3
4
5
6
struct List_node
{
	List_node* _Next;
    List_node* _Prev; 
    int _Myval; //值
}

list->MyHead->Next为list.front();

list->MyHead->Prev为list.back();

0%