GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • cpprefjp - C++日本語リファレンス
  • GitHub Project

This view

  • Original page
  • New address

GeezerVison is showing cpprefjp.github.io — unordered_map - cpprefjp C++日本語リファレンス

  1. リファレンス
  2. unordered_map

最終更新日時: 2020年11月19日 14時42分25秒 (JST)
Akira Takahashi が更新

履歴 編集

<unordered_map>

unordered_map(C++11)

<unordered_map> ヘッダは、キーと値のペアが要素である非順序連想コンテナを提供する。

<map> と異なり、各要素はキーの順序ではなくキーのハッシュ値に基づいて格納されるため、イテレータを用いたコンテナの走査の順序は(名前の通り)有意ではない。

<unordered_map> ヘッダで提供されるコンテナは、operator== と operator!= を除いてコンテナとしての要件を満たす。

operator== と operator!= も、コンテナの要素が一致する(あるいは一致しない)という点では他のコンテナ同様の意味を持つが、上記のとおりイテレータでの走査順が有意でないため、他のコンテナと同一のセマンティクスで(std::equal を用いて)定義することはできない。

<unordered_map> ヘッダでは、キーの重複を許さない std::unordered_map クラステンプレート、およびキーの重複を許す std::unordered_multimap クラステンプレートを提供する。

このヘッダでは、以下の標準ヘッダをインクルードする:

  • <initializer_list>
  • <compare> (C++20)
名前 説明 対応バージョン
unordered_map キーの重複を許さない非順序連想コンテナ(class template) C++11
unordered_multimap キーの重複を許す非順序連想コンテナ(class template) C++11

#include <initializer_list>

namespace std {
  // クラステンプレート unordered_map
  template <class Key,
            class T,
            class Hash = std::hash<Key>,
            class Pred = std::equal_to<Key>,
            class Allocator = std::allocator<std::pair<const Key, T> > >
    class unordered_map;

  // クラステンプレート unordered_multimap
  template <class Key,
            class T,
            class Hash = std::hash<Key>,
            class Pred = std::equal_to<Key>,
            class Allocator = std::allocator<std::pair<const Key, T> > >
    class unordered_multimap;

  template <class Key, class T, class Hash, class Pred, class Allocator>
    void swap(unordered_map<Key, T, Hash, Pred, Allocator>& x,
              unordered_map<Key, T, Hash, Pred, Allocator>& y);

  template <class Key, class T, class Hash, class Pred, class Allocator>
    void swap(unordered_multimap<Key, T, Hash, Pred, Allocator>& x,
              unordered_multimap<Key, T, Hash, Pred, Allocator>& y);

  template <class Key, class T, class Hash, class Pred, class Allocator>
    bool operator==(const unordered_map<Key, T, Hash, Pred, Allocator>& a,
                    const unordered_map<Key, T, Hash, Pred, Allocator>& b);
  template <class Key, class T, class Hash, class Pred, class Allocator>
    bool operator!=(const unordered_map<Key, T, Hash, Pred, Allocator>& a,
                    const unordered_map<Key, T, Hash, Pred, Allocator>& b);

  template <class Key, class T, class Hash, class Pred, class Allocator>
    bool operator==(const unordered_multimap<Key, T, Hash, Pred, Allocator>& a,
                    const unordered_multimap<Key, T, Hash, Pred, Allocator>& b);
  template <class Key, class Hash, class Pred, class Allocator>
    bool operator!=(const unordered_multimap<Key, T, Hash, Pred, Allocator>& a,
                    const unordered_multimap<Key, T, Hash, Pred, Allocator>& b);
}

バージョン

言語

  • C++11

参照

  • クソザコ鳥頭が非順序連想コンテナに入門してみた
    Boost.勉強会 #19 東京で使用した非順序連想コンテナの入門資料
  • N2930 Range-Based For Loop Wording (Without Concepts)
  • P2051R0 C++ Standard Library Issues to be moved in Prague
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.