mirror of
https://github.com/greg7mdp/parallel-hashmap.git
synced 2026-08-31 01:20:40 +08:00
Fix compilation errors with gcc 4.8.5
Thanks to @aengusjiang for the initial PR, which I updated to simplify and fix compilation issues on windows.
This commit is contained in:
Vendored
+8
-8
@@ -108,7 +108,7 @@ namespace phmap {
|
||||
bool, std::is_copy_constructible<
|
||||
type_traits_internal::SingleMemberUnion<T>>::value &&
|
||||
std::is_trivially_destructible<T>::value> {};
|
||||
|
||||
#if 0
|
||||
template <class T>
|
||||
struct IsTriviallyMoveAssignableReference : std::false_type {};
|
||||
|
||||
@@ -119,7 +119,7 @@ namespace phmap {
|
||||
template <class T>
|
||||
struct IsTriviallyMoveAssignableReference<T&&>
|
||||
: std::is_trivially_move_assignable<T>::type {};
|
||||
|
||||
#endif
|
||||
} // namespace type_traits_internal
|
||||
|
||||
|
||||
@@ -148,8 +148,8 @@ namespace phmap {
|
||||
|
||||
public:
|
||||
static constexpr bool kValue =
|
||||
(std::is_trivially_copyable<ExtentsRemoved>::value || !kIsCopyOrMoveConstructible) &&
|
||||
(std::is_trivially_copy_assignable<ExtentsRemoved>::value || !kIsCopyOrMoveAssignable) &&
|
||||
(phmap::is_trivially_copyable<ExtentsRemoved>::value || !kIsCopyOrMoveConstructible) &&
|
||||
(phmap::is_trivially_copy_assignable<ExtentsRemoved>::value || !kIsCopyOrMoveAssignable) &&
|
||||
(kIsCopyOrMoveConstructible || kIsCopyOrMoveAssignable) &&
|
||||
std::is_trivially_destructible<ExtentsRemoved>::value &&
|
||||
// We need to check for this explicitly because otherwise we'll say
|
||||
@@ -3321,8 +3321,8 @@ namespace priv {
|
||||
// ----------------
|
||||
template <typename K = key_type>
|
||||
size_type count(const key_arg<K> &key) const {
|
||||
auto equal_range = this->equal_range(key);
|
||||
return std::distance(equal_range.first, equal_range.second);
|
||||
auto er = this->equal_range(key);
|
||||
return std::distance(er.first, er.second);
|
||||
}
|
||||
template <typename K = key_type>
|
||||
iterator find(const key_arg<K> &key) {
|
||||
@@ -3362,8 +3362,8 @@ namespace priv {
|
||||
}
|
||||
template <typename K = key_type>
|
||||
size_type erase(const key_arg<K> &key) {
|
||||
auto equal_range = this->equal_range(key);
|
||||
return tree_.erase_range(equal_range.first, equal_range.second).first;
|
||||
auto er = this->equal_range(key);
|
||||
return tree_.erase_range(er.first, er.second).first;
|
||||
}
|
||||
node_type extract(iterator position) {
|
||||
// Use Move instead of Transfer, because the rebalancing code expects to
|
||||
|
||||
Vendored
+39
-4
@@ -223,6 +223,36 @@ struct disjunction<> : std::false_type {};
|
||||
template <typename T>
|
||||
struct negation : std::integral_constant<bool, !T::value> {};
|
||||
|
||||
#if defined(__GNUC__) && __GNUC__ < 5 && !defined(__clang__) && !defined(_MSC_VER) && !defined(__INTEL_COMPILER)
|
||||
#define PHMAP_OLD_GCC 1
|
||||
#else
|
||||
#define PHMAP_OLD_GCC 0
|
||||
#endif
|
||||
|
||||
#if PHMAP_OLD_GCC
|
||||
template <typename T>
|
||||
struct is_trivially_copy_constructible
|
||||
: std::integral_constant<bool,
|
||||
__has_trivial_copy(typename std::remove_reference<T>::type) &&
|
||||
std::is_copy_constructible<T>::value &&
|
||||
std::is_trivially_destructible<T>::value> {};
|
||||
|
||||
template <typename T>
|
||||
struct is_trivially_copy_assignable :
|
||||
std::integral_constant<bool,
|
||||
__has_trivial_assign(typename std::remove_reference<T>::type) &&
|
||||
phmap::is_copy_assignable<T>::value> {};
|
||||
|
||||
template <typename T>
|
||||
struct is_trivially_copyable :
|
||||
std::integral_constant<bool, __has_trivial_copy(typename std::remove_reference<T>::type)> {};
|
||||
|
||||
#else
|
||||
template <typename T> using is_trivially_copy_constructible = std::is_trivially_copy_constructible<T>;
|
||||
template <typename T> using is_trivially_copy_assignable = std::is_trivially_copy_assignable<T>;
|
||||
template <typename T> using is_trivially_copyable = std::is_trivially_copyable<T>;
|
||||
#endif
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// C++14 "_t" trait aliases
|
||||
// -----------------------------------------------------------------------------
|
||||
@@ -1788,8 +1818,8 @@ protected:
|
||||
// supported now, so we use is_trivially_* traits instead.
|
||||
template <typename T,
|
||||
bool unused =
|
||||
std::is_trivially_copy_constructible<T>::value &&
|
||||
std::is_trivially_copy_assignable<typename std::remove_cv<T>::type>::value &&
|
||||
phmap::is_trivially_copy_constructible<T>::value &&
|
||||
phmap::is_trivially_copy_assignable<typename std::remove_cv<T>::type>::value &&
|
||||
std::is_trivially_destructible<T>::value>
|
||||
class optional_data;
|
||||
|
||||
@@ -2021,6 +2051,11 @@ struct optional_hash_base<T, decltype(std::hash<phmap::remove_const_t<T> >()(
|
||||
// -----------------------------------------------------------------------------
|
||||
// phmap::optional class definition
|
||||
// -----------------------------------------------------------------------------
|
||||
#if PHMAP_OLD_GCC
|
||||
#define PHMAP_OPTIONAL_NOEXCEPT
|
||||
#else
|
||||
#define PHMAP_OPTIONAL_NOEXCEPT noexcept
|
||||
#endif
|
||||
|
||||
template <typename T>
|
||||
class optional : private optional_internal::optional_data<T>,
|
||||
@@ -2047,7 +2082,7 @@ public:
|
||||
optional(const optional& src) = default;
|
||||
|
||||
// Move constructor, standard semantics
|
||||
optional(optional&& src) noexcept = default;
|
||||
optional(optional&& src) PHMAP_OPTIONAL_NOEXCEPT = default;
|
||||
|
||||
// Constructs a non-empty `optional` direct-initialized value of type `T` from
|
||||
// the arguments `std::forward<Args>(args)...` within the `optional`.
|
||||
@@ -2187,7 +2222,7 @@ public:
|
||||
optional& operator=(const optional& src) = default;
|
||||
|
||||
// Move assignment operator, standard semantics
|
||||
optional& operator=(optional&& src) noexcept = default;
|
||||
optional& operator=(optional&& src) PHMAP_OPTIONAL_NOEXCEPT = default;
|
||||
|
||||
// Value assignment operators
|
||||
template <
|
||||
|
||||
Vendored
+7
-3
@@ -120,7 +120,7 @@
|
||||
#define PHMAP_HAVE_BUILTIN(x) 0
|
||||
#endif
|
||||
|
||||
#if (defined(_MSVC_LANG) && _MSVC_LANG >= 201703) || __cplusplus >= 201703
|
||||
#if (!defined(__GNUC__) || __GNUC__ >= 5) && ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
|
||||
#define PHMAP_HAVE_CC17 1
|
||||
#else
|
||||
#define PHMAP_HAVE_CC17 0
|
||||
@@ -313,8 +313,12 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if PHMAP_HAVE_CC17 && (!defined(__has_include) || __has_include(<shared_mutex>))
|
||||
#define PHMAP_HAVE_SHARED_MUTEX 1
|
||||
#if PHMAP_HAVE_CC17
|
||||
#ifdef __has_include
|
||||
#if __has_include(<shared_mutex>)
|
||||
#define PHMAP_HAVE_SHARED_MUTEX 1
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef PHMAP_HAVE_STD_STRING_VIEW
|
||||
|
||||
Reference in New Issue
Block a user