STL list原始碼解析

2021-10-04 19:49:26 字數 1716 閱讀 7477

templatestruct __list_node 

底層是雙向鍊錶

template class __list_iterator

......

t& operator *()

t* operator->()

self& operator++()

self operator++(int)

self& operator--()

self operator--(int)

bool operator==(const __list_iterator& rhs)

bool operator!=(const __list_iterator& rhs)

}

templateclass list

// 建構函式

iterator end()

size_type size()

bool empty() const

reference front()

refrence back();

}

申請乙個節點的記憶體

link_type get_node()
釋放乙個節點

void put_node(link_type p)
申請記憶體並構造乙個節點

link_type create_node(const t& x)

析構並釋放乙個節點

void destroy_node(link_type p)

5.建構函式

public:

list()

protected:

void empty_initialize()

6.插入

iterator insert(iterator position, const t& x)

push_front():

void push_front(const t& x)
push_back():

void push_back(const t& x)
erase(iterator position)

void erase(iterator position)

移除頭節點

void pop_front()
移除末尾節點

void pop_back()
清空節點

templatevoid listclear()

node->prev = node;

node->next = node;

}

將值為value的元素都去掉

void remove(const t& x)

}

雙向鍊錶去重

void unique()

}

VS 2010 STL list原始碼分析

template class list nod templateclass list nod public container base 即為 container base12 list nod alloc al alnod al alval al list nod list的實現包括頭指標 nod...

Fabric 原始碼解析 原始碼目錄解析

這裡對重要的一些目錄進行說明 bccsp 與密碼學 加密 簽名 證書等等 相關的加密服務 將fabric中用到的密碼學相關的函式抽象成了一組介面,便於拓展。bddtests 一種新型的軟體開發模式 行為驅動開 需求 開發 common 一些公共庫 錯誤處理 日誌處理 賬本儲存 策略以及各種工具等等 ...

Spring原始碼解析之 Aop原始碼解析(2)

spring aop 更多的是oop開發模式的乙個補充,幫助oop以更好的方式來解決對於需要解決業務功能模組之上統一管理 的功能 以一副圖來做為aop功能的說明更直觀些。對於類似系統的安全檢查,系統日誌,事務管理等相關功能,物件導向的開發方法並沒有更好的解決方法 aop引入了一些概念。更多的是spr...