diff --git a/parallel_hashmap/phmap.h b/parallel_hashmap/phmap.h index 60d2030..a421587 100644 --- a/parallel_hashmap/phmap.h +++ b/parallel_hashmap/phmap.h @@ -1450,7 +1450,7 @@ public: template ::value, int>::type = 0> std::pair emplace(Args&&... args) { - typename std::aligned_storage::type + typename phmap::aligned_storage::type raw; slot_type* slot = reinterpret_cast(&raw); @@ -1461,7 +1461,7 @@ public: template ::value, int>::type = 0> std::pair emplace_with_hash(size_t hashval, Args&&... args) { - typename std::aligned_storage::type raw; + typename phmap::aligned_storage::type raw; slot_type* slot = reinterpret_cast(&raw); PolicyTraits::construct(&alloc_ref(), slot, std::forward(args)...); @@ -2053,7 +2053,7 @@ private: // mark target as FULL // repeat procedure for current slot with moved from element (target) ConvertDeletedToEmptyAndFullToDeleted(ctrl_, capacity_); - typename std::aligned_storage::type + typename phmap::aligned_storage::type raw; slot_type* slot = reinterpret_cast(&raw); for (size_t i = 0; i != capacity_; ++i) { @@ -3087,7 +3087,7 @@ public: template ::value, int>::type = 0> std::pair emplace_with_hash(size_t hashval, Args&&... args) { - typename std::aligned_storage::type raw; + typename phmap::aligned_storage::type raw; slot_type* slot = reinterpret_cast(&raw); PolicyTraits::construct(&alloc_ref(), slot, std::forward(args)...); @@ -3160,7 +3160,7 @@ public: template ::value, int>::type = 0> std::pair emplace(Args&&... args) { - typename std::aligned_storage::type raw; + typename phmap::aligned_storage::type raw; slot_type* slot = reinterpret_cast(&raw); size_t hashval = this->hash(PolicyTraits::key(slot)); diff --git a/parallel_hashmap/phmap_base.h b/parallel_hashmap/phmap_base.h index 2a2f380..0cb8931 100644 --- a/parallel_hashmap/phmap_base.h +++ b/parallel_hashmap/phmap_base.h @@ -96,19 +96,6 @@ struct VoidTImpl { using type = void; }; -// This trick to retrieve a default alignment is necessary for our -// implementation of aligned_storage_t to be consistent with any implementation -// of std::aligned_storage. -// --------------------------------------------------------------------------- -template > -struct default_alignment_of_aligned_storage; - -template -struct default_alignment_of_aligned_storage> { - static constexpr size_t value = Align; -}; - // NOTE: The `is_detected` family of templates here differ from the library // fundamentals specification in that for library fundamentals, `Op` is // evaluated as soon as the type `is_detected` undergoes @@ -308,9 +295,15 @@ using remove_extent_t = typename std::remove_extent::type; template using remove_all_extents_t = typename std::remove_all_extents::type; -template ::value> -using aligned_storage_t = typename std::aligned_storage::type; +template +struct aligned_storage { + struct type { + alignas(Align) unsigned char data[Len]; + }; +}; + +template< std::size_t Len, std::size_t Align> +using aligned_storage_t = typename aligned_storage::type; template using decay_t = typename std::decay::type;