【正文】
cout . endl。 cout After the 2nd element is deleted, the hash_map hm1 is: 。t have an element with a key of 4. endl。 cout hm1_pIter second。 cout The original key/values of hm1 =。 ( Int_Pair ( 1, 10 ) )。 using namespace stdext。 使用 hash_map ? Stores and retrieves data quickly from a collection in which each element is a pair that has a sort key whose value is unique and an associated data value. ? template class Key, class Type, class Traits=hash_pareKey, lessKey , class Allocator=allocatorpair const Key, Type class hash_map Key ? The key data type to be stored in the hash_map. ? Type ? The element data type to be stored in the hash_map. ? Traits ? pare function objects。 ? set 包含一個單一鍵值,有效支持關(guān)于元素是否存在的查詢。 Queue特點(diǎn) ? FIFO ? 加入隊列尾部 (push) ? 出隊列 (pop) ? 獲得隊前元素 (front) ? 獲得隊尾元素 (back) Stack特點(diǎn) ? FILO先進(jìn)后出 ? 壓元素入棧 push ? 獲得頂元素 top ? 彈出棧頂元素 pop 使用序列式容器( vector, deque, list) 處理有順序的相同類型對象 ? Vector – 連續(xù)內(nèi)存,隨機(jī)訪問速度快,插入,刪除操作慢,末端插入和刪除效率高 ? Deque – 連續(xù)內(nèi)存,雙向插入和刪除效率高 ? List – 非連續(xù)內(nèi)存,雙向鏈表,特點(diǎn)與 vector相反 序列容器操作 ? push_back()和pop_back(), pop_back不能得到末端元素,用back()可 ? 除 vector外,有push_front()和pop_front() ? 例如: 序列容器的插入操作 元素插入 元素插入 序列容器刪除操作 關(guān)聯(lián)容器 map, set ? Map是 pairkey, value的集合 ,key不能重復(fù)(multimap), pair可用 make