Jean-Marc Lasgouttes wrote:

> Would there be a way to avoid this problem? I tried to think about how
> to make std::swap fail, for example, but I do not know.

Inheriting from boost::noncopyable should work, but will of course prevent
copying at other places, too.

> Or we could 
> have a std::swap specialization for RandomAccessList. Wouldn't this be
> better than a member function?

I don't know if it is legal. The standard containers do have the member
function, so if we specialize std::swap we should do it in addition, not
instead of the member function. That would look like the attached.

> Georg> Indeed. Shall we change it?
> 
> Maybe in 1.5.

I put it on my todo list.


Georg
Index: src/support/RandomAccessList.h
===================================================================
--- src/support/RandomAccessList.h	(Revision 13899)
+++ src/support/RandomAccessList.h	(Arbeitskopie)
@@ -276,4 +276,14 @@ private:
 	IterCont iterCont_;
 };
 
+
+namespace std {
+
+template <typename T>
+void swap(RandomAccessList<T> & l1, RandomAccessList<T> & l2)
+{
+	l1.swap(l2);
+}
+
+}
 #endif

Reply via email to