tbb_hash_compare クラスと tbb_hash クラス

概要

インテル® TBB によって提供される結合コンテナー用のハッシュ・サポート・クラス。

構文

template<typename Key> struct tbb_hash_compare;
template<typename Key> struct tbb_hash;

説明

tbb_hash_compare<Key> は、concurrent_hash_map テンプレート・クラスの HashCompare 引数のデフォルトです。tbb_hash<Key> は、concurrent_unordered_[multi]map および concurrent_unordered_[multi]set テンプレート・クラスの Hasher 引数のデフォルトです。メンバーの説明で示すように、ビルトインの定義は operator==tbb_hasher に依存します。独自の型で、tbb_hash_comparetbb_hash テンプレートの特殊化、または tbb_hasher のオーバーロードを定義できます。

次の Key 型については、tbb_hasher のビルトインの定義があります。

メンバー

namespace tbb {
    template<typename T> 
    size_t tbb_hasher(const T&);

    template<typename T> 
    size_t tbb_hasher(T*);

    template<typename T, typename Traits, typename Alloc>
    size_t tbb_hasher(const std::basic_string<T, Traits,Alloc>&);

    template<typename T1, typename T2>
    size_t tbb_hasher(const std::pair<T1,T2>& );

    template<typename Key>
    struct tbb_hash_compare {
        static size_t hash(const Key& k) {
            return tbb_hasher(k);
        }
        static bool equal(const Key& k1, const Key& k2) {
            return k1==k2;
        }
    };

    template<typename Key>
    struct tbb_hash {
        tbb_hash() {}
        size_t operator()(const Key& k) const {
            return tbb_hasher(k);
        }
    };
}

関連情報