mirror of
https://github.com/boostorg/unordered.git
synced 2025-07-30 19:37:14 +02:00
Add a helper function for creating null pointers.
[SVN r42155]
This commit is contained in:
@ -42,6 +42,9 @@ namespace boost {
|
||||
#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||
template <class T>
|
||||
inline void reset(T& x) { x = T(); }
|
||||
|
||||
template <class Ptr>
|
||||
inline Ptr null_ptr() { return Ptr(); }
|
||||
#else
|
||||
template <class T>
|
||||
inline void reset_impl(T& x, ...) { x = T(); }
|
||||
@ -49,6 +52,9 @@ namespace boost {
|
||||
inline void reset_impl(T*& x, int) { x = 0; }
|
||||
template <class T>
|
||||
inline void reset(T& x) { reset_impl(x); }
|
||||
|
||||
template <class Ptr>
|
||||
inline Ptr null_ptr() { Ptr x; reset(x); return x; }
|
||||
#endif
|
||||
|
||||
// Work around for Microsoft's ETI bug.
|
||||
|
@ -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>();
|
||||
}
|
||||
|
||||
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<link_ptr>();
|
||||
|
||||
// Find the start of the group.
|
||||
link_ptr start = split;
|
||||
|
Reference in New Issue
Block a user