hash_map::const_iterator
![]() |
---|
這個 API 已經過時。這個選項是 unordered_map Class。 |
提供雙向 Iterator 可讀取 hash_map 的一個 const 元素的型別。
typedef list<typename Traits::value_type, typename Traits::allocator_type>::const_iterator const_iterator;
備註
型別 const_iterator 不能用來修改項目的值。
hash_map 點所定義 const_iterator 造成 value_type物件的項目,也就是型別 pair*<const Key, Type>*,第一個成員是索引鍵的項目,第二個成員是這個項目保有的對應的基準。
若要解除 const_iterator 指向 hash_map 的項目的 cIter ,請使用 -> 運算子。
存取索引鍵值的項目,請使用 cIter -> first,與cIter(*).first相等。 存取對應的基準值的項目,請使用 cIter -> second,與cIter(*).second相等。
在 Visual C++ .NET Pocket PC, <hash_map> 和 <hash_set> 標頭檔 (Header File) 的成員不在 std 命名空間,,而是移至 stdext 命名空間。 如需詳細資訊,請參閱 stdext 命名空間。
範例
使用 const_iterator,為範例的 啟動 參閱範例。
需求
標題: <hash_map>
命名空間: stdext