Skip to content
This repository has been archived by the owner on Dec 26, 2023. It is now read-only.

Commit

Permalink
Restore is_transparent_tag and related operations
Browse files Browse the repository at this point in the history
  • Loading branch information
gergondet committed Jun 16, 2020
1 parent 39e2912 commit b42b741
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/include/robin_hood.h
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,8 @@ struct nothrow {

} // namespace detail

struct is_transparent_tag {};

// A custom pair implementation is used in the map because std::pair is not is_trivially_copyable,
// which means it would not be allowed to be used in std::memcpy. This struct is copyable, which is
// also tested.
Expand Down Expand Up @@ -1742,6 +1744,13 @@ class Table
return const_iterator{mKeyVals + idx, mInfo + idx};
}

template <typename OtherKey>
const_iterator find(const OtherKey& key, is_transparent_tag /*unused*/) const {
ROBIN_HOOD_TRACE(this);
const size_t idx = findIdx(key);
return const_iterator{mKeyVals + idx, mInfo + idx};
}

template <typename OtherKey, typename Self_ = Self>
typename std::enable_if<Self_::is_transparent, const_iterator>::type
find(const OtherKey& key) const {
Expand All @@ -1756,6 +1765,13 @@ class Table
return iterator{mKeyVals + idx, mInfo + idx};
}

template <typename OtherKey>
iterator find(const OtherKey& key, is_transparent_tag /*unused*/) {
ROBIN_HOOD_TRACE(this);
const size_t idx = findIdx(key);
return iterator{mKeyVals + idx, mInfo + idx};
}

template <typename OtherKey, typename Self_ = Self>
typename std::enable_if<Self_::is_transparent, iterator>::type find(const OtherKey& key) {
ROBIN_HOOD_TRACE(this);
Expand Down

0 comments on commit b42b741

Please sign in to comment.