diff --git a/include/boost/unordered/detail/allocator.hpp b/include/boost/unordered/detail/allocator.hpp index 5e421ea6..671b130c 100644 --- a/include/boost/unordered/detail/allocator.hpp +++ b/include/boost/unordered/detail/allocator.hpp @@ -42,6 +42,9 @@ namespace boost { #if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) template inline void reset(T& x) { x = T(); } + + template + inline Ptr null_ptr() { return Ptr(); } #else template inline void reset_impl(T& x, ...) { x = T(); } @@ -49,6 +52,9 @@ namespace boost { inline void reset_impl(T*& x, int) { x = 0; } template inline void reset(T& x) { reset_impl(x); } + + template + inline Ptr null_ptr() { Ptr x; reset(x); return x; } #endif // Work around for Microsoft's ETI bug. diff --git a/include/boost/unordered/detail/hash_table_impl.hpp b/include/boost/unordered/detail/hash_table_impl.hpp index 30ad108b..1cd70e48 100644 --- a/include/boost/unordered/detail/hash_table_impl.hpp +++ b/include/boost/unordered/detail/hash_table_impl.hpp @@ -424,9 +424,7 @@ namespace boost { link_ptr end(size_type) const { - link_ptr ptr = link_ptr(); - BOOST_HASH_MSVC_RESET_PTR(ptr); - return ptr; + return unordered_detail::null_ptr(); } link_ptr begin(bucket_ptr b) const @@ -658,11 +656,8 @@ namespace boost { { // If split is at the beginning of the group then there's // nothing to split. - if(prev_in_group(split)->next_ != split) { - link_ptr ptr = link_ptr(); - BOOST_HASH_MSVC_RESET_PTR(ptr); - return ptr; - } + if(prev_in_group(split)->next_ != split) + return unordered_detail::null_ptr(); // Find the start of the group. link_ptr start = split;