Add a helper function for creating null pointers.

[SVN r42155]
This commit is contained in:
Daniel James
2007-12-18 22:58:12 +00:00
parent 73dea3ed4d
commit f43a74a93f
2 changed files with 9 additions and 8 deletions

View File

@ -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.

View File

@ -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;