> -----Original Message-----
> From: Martin Sebor [mailto:[EMAIL PROTECTED]
> Sent: Thursday, September 28, 2006 5:29 PM
> To: [email protected]
> Subject: Re: [PATCH] std::swap (std::container&,
> std::container&) in MSVC 7.0
>
> Okay, so it doesn't sound like we need it. We can add it
> if/when we find a compiler that doesn't support inline
> friends and that also doesn't do partial ordering of function
> templates.

  The updated (with updating the licensing header) patch is attached:

   ChangeLog:
   * deque: Added #ifndef _RWSTD_NO_PART_SPEC_OVERLOAD/#endif around the
   function std::swap<T, A> (std::deque<T, A>&, std::deque<T, A>&);
   [_RWSTD_NO_PART_SPEC_OVERLOAD]: Added function std::swap
   (std::deque&, std::deque&)
   * list [_RWSTD_NO_PART_SPEC_OVERLOAD]: Added function
   std::swap (std::list&, std::list&)
   * map [_RWSTD_NO_PART_SPEC_OVERLOAD]: Added functions
   std::swap (std::map&, std::map&) and
   std::swap (std::multimap&, std::multimap&)
   * set [_RWSTD_NO_PART_SPEC_OVERLOAD]: Added functions
   std::swap (std::set&, std::set&) and
   std::swap (std::multiset&, std::multiset&)
   * string [_RWSTD_NO_PART_SPEC_OVERLOAD]: Added function
   std::swap (std::string&, std::string&)
   * vector [_RWSTD_NO_PART_SPEC_OVERLOAD]: Added functions
   std::swap (std::vector&, std::vector&) and
   std::swap (std::vector<bool>&, std::vector<bool>&)

Farid.
Index: deque
===================================================================
--- deque       (revision 450884)
+++ deque       (working copy)
@@ -7,36 +7,26 @@
  *
  ***************************************************************************
  *
- * Copyright (c) 1994
- * Hewlett-Packard Company
+ * Licensed to the Apache Software  Foundation (ASF) under one or more
+ * contributor  license agreements.  See  the NOTICE  file distributed
+ * with  this  work  for  additional information  regarding  copyright
+ * ownership.   The ASF  licenses this  file to  you under  the Apache
+ * License, Version  2.0 (the  "License"); you may  not use  this file
+ * except in  compliance with the License.   You may obtain  a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the  License is distributed on an  "AS IS" BASIS,
+ * WITHOUT  WARRANTIES OR CONDITIONS  OF ANY  KIND, either  express or
+ * implied.   See  the License  for  the  specific language  governing
+ * permissions and limitations under the License.
  *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation.  Hewlett-Packard Company makes no
- * representations about the suitability of this software for any
- * purpose.  It is provided "as is" without express or implied warranty.
- *
- ***************************************************************************
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors,
- * as applicable.
- *
  * Copyright 1994-2006 Rogue Wave Software.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Copyright (c) 1994 Hewlett-Packard Company
  *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * 
  **************************************************************************/
 
 #ifndef _RWSTD_DEQUE_INCLUDED
@@ -651,6 +641,14 @@
         _RWSTD_ASSERT (_C_is_valid (1 /* valid and empty */));
     }
 
+#if defined (_RWSTD_NO_PART_SPEC_OVERLOAD)
+    friend void swap (deque& __lhs, deque& __rhs)
+    {
+        __lhs.swap (__rhs);
+    }
+#endif
+
+
 private:
 
     //////////////////////////////////////////////////////////////////
@@ -983,6 +981,8 @@
 }
 
 
+#ifndef _RWSTD_NO_PART_SPEC_OVERLOAD
+
 template <class _TypeT, class _Allocator>
 inline void
 swap (deque<_TypeT, _Allocator> &__lhs, deque<_TypeT, _Allocator> &__rhs)
@@ -990,6 +990,7 @@
     __lhs.swap (__rhs);
 }
 
+#endif   // _RWSTD_NO_PART_SPEC_OVERLOAD
 
 }   // namespace end
 
Index: list
===================================================================
--- list        (revision 450884)
+++ list        (working copy)
@@ -7,29 +7,25 @@
  *
  ***************************************************************************
  *
- * Copyright (c) 1994
- * Hewlett-Packard Company
+ * Licensed to the Apache Software  Foundation (ASF) under one or more
+ * contributor  license agreements.  See  the NOTICE  file distributed
+ * with  this  work  for  additional information  regarding  copyright
+ * ownership.   The ASF  licenses this  file to  you under  the Apache
+ * License, Version  2.0 (the  "License"); you may  not use  this file
+ * except in  compliance with the License.   You may obtain  a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the  License is distributed on an  "AS IS" BASIS,
+ * WITHOUT  WARRANTIES OR CONDITIONS  OF ANY  KIND, either  express or
+ * implied.   See  the License  for  the  specific language  governing
+ * permissions and limitations under the License.
  *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation.  Hewlett-Packard Company makes no
- * representations about the suitability of this software for any
- * purpose.  It is provided "as is" without express or implied warranty.
+ * Copyright 1994-2005 Rogue Wave Software.
  *
- ***************************************************************************
- *
- * Copyright (c) 1994-2005 Quovadx,  Inc., acting through its  Rogue Wave
- * Software division. Licensed under the Apache License, Version 2.0 (the
- * "License");  you may  not use this file except  in compliance with the
- * License.    You    may   obtain   a   copy   of    the   License    at
- * http://www.apache.org/licenses/LICENSE-2.0.    Unless   required    by
- * applicable law  or agreed to  in writing,  software  distributed under
- * the License is distributed on an "AS IS" BASIS,  WITHOUT WARRANTIES OR
- * CONDITIONS OF  ANY KIND, either  express or implied.  See  the License
- * for the specific language governing permissions  and limitations under
- * the License.
+ * Copyright (c) 1994 Hewlett-Packard Company
  * 
  **************************************************************************/
 
@@ -664,6 +660,13 @@
         erase (begin (), end ());
     }
 
+#if defined (_RWSTD_NO_PART_SPEC_OVERLOAD)
+    friend void swap (list& __lhs, list& __rhs)
+    {
+        __lhs.swap (__rhs);
+    }
+#endif
+
 protected:
     
     void _C_transfer (iterator, iterator, iterator, list&);
Index: map
===================================================================
--- map (revision 450884)
+++ map (working copy)
@@ -7,35 +7,25 @@
  *
  ***************************************************************************
  *
- * Copyright (c) 1994
- * Hewlett-Packard Company
+ * Licensed to the Apache Software  Foundation (ASF) under one or more
+ * contributor  license agreements.  See  the NOTICE  file distributed
+ * with  this  work  for  additional information  regarding  copyright
+ * ownership.   The ASF  licenses this  file to  you under  the Apache
+ * License, Version  2.0 (the  "License"); you may  not use  this file
+ * except in  compliance with the License.   You may obtain  a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the  License is distributed on an  "AS IS" BASIS,
+ * WITHOUT  WARRANTIES OR CONDITIONS  OF ANY  KIND, either  express or
+ * implied.   See  the License  for  the  specific language  governing
+ * permissions and limitations under the License.
  *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation.  Hewlett-Packard Company makes no
- * representations about the suitability of this software for any
- * purpose.  It is provided "as is" without express or implied warranty.
- *
- ***************************************************************************
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors,
- * as applicable.
- *
  * Copyright 1994-2006 Rogue Wave Software.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Copyright (c) 1994 Hewlett-Packard Company
  * 
  **************************************************************************/
 
@@ -300,6 +290,14 @@
     equal_range (const key_type& __x) const {
         return _C_rep.equal_range (__x);
     }
+
+#if defined (_RWSTD_NO_PART_SPEC_OVERLOAD)
+    friend void swap (map& __lhs, map& __rhs)
+    {
+        __lhs.swap (__rhs);
+    }
+#endif
+
 };
 
 
@@ -529,6 +527,14 @@
     equal_range (const key_type& __x) const {
         return _C_rep.equal_range (__x);
     }
+
+#if defined (_RWSTD_NO_PART_SPEC_OVERLOAD)
+    friend void swap (multimap& __lhs, multimap& __rhs)
+    {
+        __lhs.swap (__rhs);
+    }
+#endif
+
 };
 
 
Index: set
===================================================================
--- set (revision 450884)
+++ set (working copy)
@@ -7,35 +7,25 @@
  *
  ***************************************************************************
  *
- * Copyright (c) 1994
- * Hewlett-Packard Company
+ * Licensed to the Apache Software  Foundation (ASF) under one or more
+ * contributor  license agreements.  See  the NOTICE  file distributed
+ * with  this  work  for  additional information  regarding  copyright
+ * ownership.   The ASF  licenses this  file to  you under  the Apache
+ * License, Version  2.0 (the  "License"); you may  not use  this file
+ * except in  compliance with the License.   You may obtain  a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the  License is distributed on an  "AS IS" BASIS,
+ * WITHOUT  WARRANTIES OR CONDITIONS  OF ANY  KIND, either  express or
+ * implied.   See  the License  for  the  specific language  governing
+ * permissions and limitations under the License.
  *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation.  Hewlett-Packard Company makes no
- * representations about the suitability of this software for any
- * purpose.  It is provided "as is" without express or implied warranty.
- *
- ***************************************************************************
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors,
- * as applicable.
- *
  * Copyright 1994-2006 Rogue Wave Software.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Copyright (c) 1994 Hewlett-Packard Company
  * 
  **************************************************************************/
 
@@ -301,6 +291,14 @@
     equal_range (const key_type& __x) const {
         return _C_rep.equal_range (__x);
     }
+
+#if defined (_RWSTD_NO_PART_SPEC_OVERLOAD)
+    friend void swap (set& __lhs, set& __rhs)
+    {
+        __lhs.swap (__rhs);
+    }
+#endif
+
 };
 
 
@@ -505,6 +503,14 @@
     equal_range (const key_type& __x) const {
         return _C_rep.equal_range (__x);
     }
+
+#if defined (_RWSTD_NO_PART_SPEC_OVERLOAD)
+    friend void swap (multiset& __lhs, multiset& __rhs)
+    {
+        __lhs.swap (__rhs);
+    }
+#endif
+
 };
 
 
Index: string
===================================================================
--- string      (revision 450884)
+++ string      (working copy)
@@ -7,17 +7,24 @@
  *
  ***************************************************************************
  *
- * Copyright (c) 1994-2005 Quovadx,  Inc., acting through its  Rogue Wave
- * Software division. Licensed under the Apache License, Version 2.0 (the
- * "License");  you may  not use this file except  in compliance with the
- * License.    You    may   obtain   a   copy   of    the   License    at
- * http://www.apache.org/licenses/LICENSE-2.0.    Unless   required    by
- * applicable law  or agreed to  in writing,  software  distributed under
- * the License is distributed on an "AS IS" BASIS,  WITHOUT WARRANTIES OR
- * CONDITIONS OF  ANY KIND, either  express or implied.  See  the License
- * for the specific language governing permissions  and limitations under
- * the License.
- * 
+ * Licensed to the Apache Software  Foundation (ASF) under one or more
+ * contributor  license agreements.  See  the NOTICE  file distributed
+ * with  this  work  for  additional information  regarding  copyright
+ * ownership.   The ASF  licenses this  file to  you under  the Apache
+ * License, Version  2.0 (the  "License"); you may  not use  this file
+ * except in  compliance with the License.   You may obtain  a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the  License is distributed on an  "AS IS" BASIS,
+ * WITHOUT  WARRANTIES OR CONDITIONS  OF ANY  KIND, either  express or
+ * implied.   See  the License  for  the  specific language  governing
+ * permissions and limitations under the License.
+ *
+ * Copyright 1994-2006 Rogue Wave Software.
+ *
  **************************************************************************/
 
 #ifndef _RWSTD_STRING_INCLUDED
@@ -823,6 +830,13 @@
     // lwg Issue 5
     int compare (size_type, size_type, const_pointer, size_type) const;
 
+#if defined (_RWSTD_NO_PART_SPEC_OVERLOAD)
+    friend void swap (basic_string& __lhs, basic_string& __rhs)
+    {
+        __lhs.swap (__rhs);
+    }
+#endif
+
 #if    !defined (_RWSTD_NO_INLINE_MEMBER_TEMPLATES)                            
\
     && (!defined (_MSC_VER) || _MSC_VER >= 1300 || defined (__INTEL_COMPILER)) 
\
     && defined (_RWSTD_NO_MEMBER_TEMPLATES)
Index: vector
===================================================================
--- vector      (revision 450884)
+++ vector      (working copy)
@@ -7,35 +7,25 @@
  *
  ***************************************************************************
  *
- * Copyright (c) 1994
- * Hewlett-Packard Company
+ * Licensed to the Apache Software  Foundation (ASF) under one or more
+ * contributor  license agreements.  See  the NOTICE  file distributed
+ * with  this  work  for  additional information  regarding  copyright
+ * ownership.   The ASF  licenses this  file to  you under  the Apache
+ * License, Version  2.0 (the  "License"); you may  not use  this file
+ * except in  compliance with the License.   You may obtain  a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the  License is distributed on an  "AS IS" BASIS,
+ * WITHOUT  WARRANTIES OR CONDITIONS  OF ANY  KIND, either  express or
+ * implied.   See  the License  for  the  specific language  governing
+ * permissions and limitations under the License.
  *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation.  Hewlett-Packard Company makes no
- * representations about the suitability of this software for any
- * purpose.  It is provided "as is" without express or implied warranty.
- *
- ***************************************************************************
- *
- * Copyright 2006 The Apache Software Foundation or its licensors,
- * as applicable.
- *
  * Copyright 1994-2006 Rogue Wave Software.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Copyright (c) 1994 Hewlett-Packard Company
  * 
  **************************************************************************/
 
@@ -370,6 +360,13 @@
         erase (begin (), end ());
     }
 
+#if defined (_RWSTD_NO_PART_SPEC_OVERLOAD)
+    friend void swap (vector& __lhs, vector& __rhs)
+    {
+        __lhs.swap (__rhs);
+    }
+#endif
+
 private:
 
     // implements assign with repetition
@@ -1432,6 +1429,14 @@
     {
       erase(begin(),end());
     }
+
+#if defined (_RWSTD_NO_PART_SPEC_OVERLOAD)
+    friend void swap (vector& __lhs, vector& __rhs)
+    {
+        __lhs.swap (__rhs);
+    }
+#endif
+
 };
 
 #undef _Allocator 

Reply via email to