zoukankan      html  css  js  c++  java
  • STL::unordered_map/unordered_multimap

    unordered_map: 和 unorder_set 相似,该容器内部同样根据 hash value 把键值对存放到相应的 bucket(slot)中,根据单个 key 来访问 value 的速度很快。

    unordered_multimap: 操作和 unorder_map 相同,不同点是 key 可以重复。通过 it.first(it->first) 访问 key 或者 it.second(it->second) 访问 mapped value。

    Iterators(只有有序的容器才有 rbegin,rend 等迭代器)

    begin:

    end:

    cbegin:

    cend:

    Capacity

    empty:

    size:

    max_size:

    Element access

    operator [ ]:

    at:

    Element lookup

    find:

    count:

    equal_range:

    Modifiers

    emplace:

    emplace_hint:

    insert:

    erase: 三种方式 by position; by key; range;

    clear:

    swap:

    Buckets

    bucket_count:

    max_bucket_count:

    bucket_size:

    bucket: 查询该 key 所在的 槽号。

    Hash policy(同 unordered_set)

    load_factor:

    max_load_factor:

    rehash:

    reserve:

    Observers

    hash_function: 是 hasher 类型,获取当前的哈希函数。

    key_eq:

    所有博文均为原著,如若转载,请注明出处!
  • 相关阅读:
    一些前台技巧
    javascript中的面向对象
    vs.net 常用快捷键
    js和C#中的进制转换方法
    MFC中CDC相关图形,文本的一些使用方法(转)
    poj1505
    poj1401
    poj2533
    poj1504
    poj1384
  • 原文地址:https://www.cnblogs.com/zpcoding/p/10338055.html
Copyright © 2011-2022 走看看