Skip to content

Commit 5f0d93c

Browse files
authored
Merge pull request #218 from Libvisual/c++-adl-swap
Core (LV::IntrusivePtr): Implement swap() overload as a friend function.
2 parents 24dd7d0 + 2025275 commit 5f0d93c

1 file changed

Lines changed: 6 additions & 11 deletions

File tree

libvisual/libvisual/lv_intrusive_ptr.hpp

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -135,22 +135,17 @@ namespace LV
135135
rhs.m_ptr = tmp;
136136
}
137137

138+
//! Swaps two intrusive pointers.
139+
friend void swap (LV::IntrusivePtr<T>& lhs, LV::IntrusivePtr<T>& rhs)
140+
{
141+
lhs.swap (rhs);
142+
}
143+
138144
private:
139145

140146
T* m_ptr;
141147
};
142148

143149
} // LV namespace
144150

145-
namespace std {
146-
147-
// std::swap() overload for efficiently swapping IntrusivePtrs
148-
template <class T>
149-
void swap (LV::IntrusivePtr<T>& lhs, LV::IntrusivePtr<T>& rhs)
150-
{
151-
lhs.swap (rhs);
152-
}
153-
154-
} // std namespace
155-
156151
#endif // _LV_INTRUSIVE_HPP

0 commit comments

Comments
 (0)