diff --git a/include/momo/HashSet.h b/include/momo/HashSet.h index b69aa7fe..7e0456ee 100644 --- a/include/momo/HashSet.h +++ b/include/momo/HashSet.h @@ -477,10 +477,7 @@ class HashSet typedef internal::HashSetBucketItemTraits BucketItemTraits; - static const bool useHashCodePartGetter = !HashTraits::isFastNothrowHashable; - - typedef typename HashTraits::HashBucket HashBucket; - typedef typename HashBucket::template Bucket Bucket; + typedef typename internal::HashTraitsBucketSelector::Bucket Bucket; typedef typename Bucket::Params BucketParams; diff --git a/include/momo/HashTraits.h b/include/momo/HashTraits.h index b669fc8b..90d68fa6 100644 --- a/include/momo/HashTraits.h +++ b/include/momo/HashTraits.h @@ -70,6 +70,21 @@ namespace internal : public std::true_type { }; + + template + struct HashTraitsBucketSelector + { + MOMO_DEPRECATED typedef typename HashTraits::HashBucket + ::template Bucket Bucket; + }; + + template + struct HashTraitsBucketSelector>> + { + typedef typename HashTraits::template Bucket Bucket; + }; } template @@ -114,12 +129,15 @@ class HashTraits typedef THashBucket HashBucket; typedef TKeyArgBase KeyArgBase; + static const bool isFastNothrowHashable = IsFastNothrowHashable::value; + + template + using Bucket = typename HashBucket::template Bucket; + template using IsValidKeyArg = typename std::conditional::value, std::false_type, std::is_convertible>::type; //? - static const bool isFastNothrowHashable = IsFastNothrowHashable::value; - public: explicit HashTraits() noexcept { @@ -182,13 +200,16 @@ class HashTraitsStd typedef TEqualFunc EqualFunc; typedef THashBucket HashBucket; - template - using IsValidKeyArg = internal::HashTraitsStdIsValidKeyArg; - static const bool isFastNothrowHashable = IsFastNothrowHashable::value && (std::is_same>::value || std::is_same>::value); + template + using Bucket = typename HashBucket::template Bucket; + + template + using IsValidKeyArg = internal::HashTraitsStdIsValidKeyArg; + public: explicit HashTraitsStd(size_t startBucketCount = size_t{1} << HashBucket::logStartBucketCount, const HashFunc& hashFunc = HashFunc(),