forked from boostorg/unordered
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)
|
#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||||
template <class T>
|
template <class T>
|
||||||
inline void reset(T& x) { x = T(); }
|
inline void reset(T& x) { x = T(); }
|
||||||
|
|
||||||
|
template <class Ptr>
|
||||||
|
inline Ptr null_ptr() { return Ptr(); }
|
||||||
#else
|
#else
|
||||||
template <class T>
|
template <class T>
|
||||||
inline void reset_impl(T& x, ...) { x = T(); }
|
inline void reset_impl(T& x, ...) { x = T(); }
|
||||||
@@ -49,6 +52,9 @@ namespace boost {
|
|||||||
inline void reset_impl(T*& x, int) { x = 0; }
|
inline void reset_impl(T*& x, int) { x = 0; }
|
||||||
template <class T>
|
template <class T>
|
||||||
inline void reset(T& x) { reset_impl(x); }
|
inline void reset(T& x) { reset_impl(x); }
|
||||||
|
|
||||||
|
template <class Ptr>
|
||||||
|
inline Ptr null_ptr() { Ptr x; reset(x); return x; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Work around for Microsoft's ETI bug.
|
// Work around for Microsoft's ETI bug.
|
||||||
|
@@ -424,9 +424,7 @@ namespace boost {
|
|||||||
|
|
||||||
link_ptr end(size_type) const
|
link_ptr end(size_type) const
|
||||||
{
|
{
|
||||||
link_ptr ptr = link_ptr();
|
return unordered_detail::null_ptr<link_ptr>();
|
||||||
BOOST_HASH_MSVC_RESET_PTR(ptr);
|
|
||||||
return ptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
link_ptr begin(bucket_ptr b) const
|
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
|
// If split is at the beginning of the group then there's
|
||||||
// nothing to split.
|
// nothing to split.
|
||||||
if(prev_in_group(split)->next_ != split) {
|
if(prev_in_group(split)->next_ != split)
|
||||||
link_ptr ptr = link_ptr();
|
return unordered_detail::null_ptr<link_ptr>();
|
||||||
BOOST_HASH_MSVC_RESET_PTR(ptr);
|
|
||||||
return ptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Find the start of the group.
|
// Find the start of the group.
|
||||||
link_ptr start = split;
|
link_ptr start = split;
|
||||||
|
Reference in New Issue
Block a user