greg7mdp / parallel-hashmap

A family of header-only, very fast and memory-friendly hashmap and btree containers.
https://greg7mdp.github.io/parallel-hashmap/
Apache License 2.0
2.47k stars 234 forks source link

::iterator not defined for parallel_node_hash_set #174

Closed Andersama closed 1 year ago

Andersama commented 1 year ago

Trying to compile the templates below the flat_intern_t doesn't have issues, but intern_t will because it appears iterator is missing. As is, the node based hash set is not a drop-in replacements for standard c++ structs.

template <typename T> struct flat_intern_t {
    using backing_container = phmap::parallel_flat_hash_set<T>;
    backing_container interned;

    __forceinline std::pair<typename backing_container::iterator, bool> intern(T &vw) {
        return interned.try_emnplace(vw);
    }

    template <typename... Args> __forceinline 
    std::pair<typename backing_container::iterator, bool> intern(Args &&...args) {
        return interned.try_emplace(std::forward<Args>(args)...);
    }
};

template <typename T> struct intern_t {
    using backing_container = phmap::parallel_node_hash_set<T>;
    backing_container interned;

    __forceinline std::pair<backing_container::iterator, bool> intern(T &vw) {
        return interned.try_emnplace(vw);
    }

    template <typename... Args> __forceinline 
    std::pair<backing_container::iterator, bool> intern(Args &&...args) {
        return interned.try_emplace(std::forward<Args>(args)...);
    }
};