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

Commit

Permalink
Adds missing methods with the const_iterator hint.
Browse files Browse the repository at this point in the history
Added for insert and emplace_hint.
Also minor version updates in the tests and clang-tidy
upgrade doctest
  • Loading branch information
martinus committed Dec 10, 2021
1 parent 9dbc277 commit 5399432
Show file tree
Hide file tree
Showing 11 changed files with 811 additions and 415 deletions.
4 changes: 4 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
---
Checks: "*,\
-altera-*,\
-bugprone-easily-swappable-parameters,\
-cert-dcl21-cpp,\
-cert-err58-cpp,\
-clang-diagnostic-reserved-identifier,\
-cppcoreguidelines-avoid-magic-numbers,\
-cppcoreguidelines-avoid-non-const-global-variables,\
-cppcoreguidelines-macro-usage,\
Expand Down Expand Up @@ -31,6 +34,7 @@ Checks: "*,\
-llvmlibc-restrict-system-libc-headers,\
-modernize-use-nullptr,\
-modernize-use-trailing-return-type,\
-readability-function-cognitive-complexity,\
-readability-magic-numbers,\
-readability-qualified-auto,\
-readability-use-anyofallof,\
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.5)
project(robin-hood-hashing
VERSION 3.10.0
VERSION 3.11.4
LANGUAGES CXX
)

Expand Down Expand Up @@ -37,7 +37,7 @@ if (RH_STANDALONE_PROJECT)
if(CCACHE_PROGRAM)
SET(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
#SET_PROPERTY(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "/home/martinus/git/rust-throttler/target/release/throttler run -g compile --")
#SET_PROPERTY(GLOBAL PROPERTY RULE_LAUNCH_LINK "/home/martinus/git/rust-throttler/target/release/throttler run -g link --")
#SET_PROPERTY(GLOBAL PROPERTY RULE_LAUNCH_LINK "/home/martinus/git/rust-throttler/target/release/throttler run -g link --")
endif()

add_executable(rh "")
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
1. Create `conanfile.txt` in your source dir (don't forget to update the version)
```ini
[requires]
robin-hood-hashing/3.10.0
robin-hood-hashing/3.11.4

[generators]
cmake
Expand Down
1 change: 1 addition & 0 deletions cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ function(add_compile_flags_target target)
target_compile_options(${target} PRIVATE -fstrict-aliasing)
target_compile_options(${target} PRIVATE -Wstrict-aliasing=2)
target_compile_options(${target} PRIVATE -Wno-zero-as-null-pointer-constant)
target_compile_options(${target} PRIVATE -Wno-reserved-identifier)
endif()

if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
Expand Down
17 changes: 16 additions & 1 deletion src/include/robin_hood.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
// see https://semver.org/
#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_PATCH 3 // for backwards-compatible bug fixes
#define ROBIN_HOOD_VERSION_PATCH 4 // for backwards-compatible bug fixes

#include <algorithm>
#include <cstdlib>
Expand Down Expand Up @@ -1820,6 +1820,11 @@ class Table
InsertionState::key_found != idxAndState.second);
}

template <typename... Args>
iterator emplace_hint(Args&&... args) {
return emplace(std::forward<Args>(args)...).first;
}

template <typename... Args>
std::pair<iterator, bool> try_emplace(const key_type& key, Args&&... args) {
return try_emplace_impl(key, std::forward<Args>(args)...);
Expand Down Expand Up @@ -1871,10 +1876,20 @@ class Table
return emplace(keyval);
}

std::pair<iterator, bool> insert(const_iterator hint, const value_type& keyval) {
(void)hint;
return emplace(keyval);
}

std::pair<iterator, bool> insert(value_type&& keyval) {
return emplace(std::move(keyval));
}

std::pair<iterator, bool> insert(const_iterator hint, value_type&& keyval) {
(void)hint;
return emplace(std::move(keyval));
}

// Returns 1 if key is found, 0 otherwise.
size_t count(const key_type& key) const { // NOLINT(modernize-use-nodiscard)
ROBIN_HOOD_TRACE(this)
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function buildAndTest() {
CXXFLAGS=$4

DIRNAME=${COMPILER}_cxx${CXX_STANDARD}_sanitizer${SANITIZER}_${CXXFLAGS}

mkdir -p ${DIRNAME}
rm -f ${DIRNAME}/CMakeCache.txt
cd ${DIRNAME}
Expand Down
52 changes: 26 additions & 26 deletions src/scripts/build_targets.ini
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#g++ 17 OFF
#clang++ 14 ON

g++-8 11 OFF
g++-8 14 OFF
g++-8 17 OFF
#g++-8 11 OFF
#g++-8 14 OFF
#g++-8 17 OFF

g++-4.9 11 OFF -m32
g++-4.9 14 OFF -m32
#g++-4.9 11 OFF -m32
#g++-4.9 14 OFF -m32
#clang++-6 20 OFF
clang++ 20 ON
clang++ 20 OFF -m32
Expand Down Expand Up @@ -35,9 +35,9 @@ g++ 14 ON -m32
g++ 17 ON -m32
g++ 20 ON -m32

clang++-6 11 OFF -m32
clang++-6 14 OFF -m32
clang++-6 17 OFF -m32
#clang++-6 11 OFF -m32
#clang++-6 14 OFF -m32
#clang++-6 17 OFF -m32
#clang++-6 20 OFF -m32

clang++ 11 OFF -m32
Expand All @@ -49,26 +49,26 @@ clang++ 20 OFF -m32


# all the rest
g++-4.9 11 OFF
g++-4.9 14 OFF
#g++-4.9 11 OFF
#g++-4.9 14 OFF

g++-5 11 OFF
g++-5 14 OFF
g++-5 17 OFF
#g++-5 11 OFF
#g++-5 14 OFF
#g++-5 17 OFF

g++-6 11 OFF
g++-6 14 OFF
g++-6 17 OFF
#g++-6 11 OFF
#g++-6 14 OFF
#g++-6 17 OFF

g++-7 11 OFF
g++-7 14 OFF
g++-7 17 OFF
#g++-7 11 OFF
#g++-7 14 OFF
#g++-7 17 OFF

g++ 11 ON
g++ 14 ON
g++ 17 ON
g++ 20 ON
#g++ 11 ON
#g++ 14 ON
#g++ 17 ON
#g++ 20 ON

clang++-6 11 OFF
clang++-6 14 OFF
clang++-6 17 OFF
#clang++-6 11 OFF
#clang++-6 14 OFF
#clang++-6 17 OFF
1 change: 1 addition & 0 deletions src/test/app/fmt/mup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <sstream>

// see http://fmtlib.net/latest/syntax.html
Expand Down
Loading

0 comments on commit 5399432

Please sign in to comment.