Update robin_hood to 3.11.5.

This commit is contained in:
Bartosz Taudul 2022-03-18 02:01:46 +01:00
parent ea59552c4e
commit fdee87b0ae
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -36,7 +36,7 @@
// see https://semver.org/ // see https://semver.org/
#define ROBIN_HOOD_VERSION_MAJOR 3 // for incompatible API changes #define ROBIN_HOOD_VERSION_MAJOR 3 // for incompatible API changes
#define ROBIN_HOOD_VERSION_MINOR 11 // for adding functionality in a backwards-compatible manner #define ROBIN_HOOD_VERSION_MINOR 11 // for adding functionality in a backwards-compatible manner
#define ROBIN_HOOD_VERSION_PATCH 3 // for backwards-compatible bug fixes #define ROBIN_HOOD_VERSION_PATCH 5 // for backwards-compatible bug fixes
#include <algorithm> #include <algorithm>
#include <cstdlib> #include <cstdlib>
@ -1820,6 +1820,12 @@ public:
InsertionState::key_found != idxAndState.second); InsertionState::key_found != idxAndState.second);
} }
template <typename... Args>
iterator emplace_hint(const_iterator position, Args&&... args) {
(void)position;
return emplace(std::forward<Args>(args)...).first;
}
template <typename... Args> template <typename... Args>
std::pair<iterator, bool> try_emplace(const key_type& key, Args&&... args) { std::pair<iterator, bool> try_emplace(const key_type& key, Args&&... args) {
return try_emplace_impl(key, std::forward<Args>(args)...); return try_emplace_impl(key, std::forward<Args>(args)...);
@ -1831,16 +1837,15 @@ public:
} }
template <typename... Args> template <typename... Args>
std::pair<iterator, bool> try_emplace(const_iterator hint, const key_type& key, iterator try_emplace(const_iterator hint, const key_type& key, Args&&... args) {
Args&&... args) {
(void)hint; (void)hint;
return try_emplace_impl(key, std::forward<Args>(args)...); return try_emplace_impl(key, std::forward<Args>(args)...).first;
} }
template <typename... Args> template <typename... Args>
std::pair<iterator, bool> try_emplace(const_iterator hint, key_type&& key, Args&&... args) { iterator try_emplace(const_iterator hint, key_type&& key, Args&&... args) {
(void)hint; (void)hint;
return try_emplace_impl(std::move(key), std::forward<Args>(args)...); return try_emplace_impl(std::move(key), std::forward<Args>(args)...).first;
} }
template <typename Mapped> template <typename Mapped>
@ -1854,16 +1859,15 @@ public:
} }
template <typename Mapped> template <typename Mapped>
std::pair<iterator, bool> insert_or_assign(const_iterator hint, const key_type& key, iterator insert_or_assign(const_iterator hint, const key_type& key, Mapped&& obj) {
Mapped&& obj) {
(void)hint; (void)hint;
return insertOrAssignImpl(key, std::forward<Mapped>(obj)); return insertOrAssignImpl(key, std::forward<Mapped>(obj)).first;
} }
template <typename Mapped> template <typename Mapped>
std::pair<iterator, bool> insert_or_assign(const_iterator hint, key_type&& key, Mapped&& obj) { iterator insert_or_assign(const_iterator hint, key_type&& key, Mapped&& obj) {
(void)hint; (void)hint;
return insertOrAssignImpl(std::move(key), std::forward<Mapped>(obj)); return insertOrAssignImpl(std::move(key), std::forward<Mapped>(obj)).first;
} }
std::pair<iterator, bool> insert(const value_type& keyval) { std::pair<iterator, bool> insert(const value_type& keyval) {
@ -1871,10 +1875,20 @@ public:
return emplace(keyval); return emplace(keyval);
} }
iterator insert(const_iterator hint, const value_type& keyval) {
(void)hint;
return emplace(keyval).first;
}
std::pair<iterator, bool> insert(value_type&& keyval) { std::pair<iterator, bool> insert(value_type&& keyval) {
return emplace(std::move(keyval)); return emplace(std::move(keyval));
} }
iterator insert(const_iterator hint, value_type&& keyval) {
(void)hint;
return emplace(std::move(keyval)).first;
}
// Returns 1 if key is found, 0 otherwise. // Returns 1 if key is found, 0 otherwise.
size_t count(const key_type& key) const { // NOLINT(modernize-use-nodiscard) size_t count(const key_type& key) const { // NOLINT(modernize-use-nodiscard)
ROBIN_HOOD_TRACE(this) ROBIN_HOOD_TRACE(this)
@ -2308,13 +2322,14 @@ private:
auto const numElementsWithBuffer = calcNumElementsWithBuffer(max_elements); auto const numElementsWithBuffer = calcNumElementsWithBuffer(max_elements);
// calloc also zeroes everything // malloc & zero mInfo. Faster than calloc everything.
auto const numBytesTotal = calcNumBytesTotal(numElementsWithBuffer); auto const numBytesTotal = calcNumBytesTotal(numElementsWithBuffer);
ROBIN_HOOD_LOG("std::calloc " << numBytesTotal << " = calcNumBytesTotal(" ROBIN_HOOD_LOG("std::calloc " << numBytesTotal << " = calcNumBytesTotal("
<< numElementsWithBuffer << ")") << numElementsWithBuffer << ")")
mKeyVals = reinterpret_cast<Node*>( mKeyVals = reinterpret_cast<Node*>(
detail::assertNotNull<std::bad_alloc>(std::calloc(1, numBytesTotal))); detail::assertNotNull<std::bad_alloc>(std::malloc(numBytesTotal)));
mInfo = reinterpret_cast<uint8_t*>(mKeyVals + numElementsWithBuffer); mInfo = reinterpret_cast<uint8_t*>(mKeyVals + numElementsWithBuffer);
std::memset(mInfo, 0, numBytesTotal - numElementsWithBuffer * sizeof(Node));
// set sentinel // set sentinel
mInfo[numElementsWithBuffer] = 1; mInfo[numElementsWithBuffer] = 1;