This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

SGI STL patch



Hi, 

i've made patch to egcs (aka SGI) STL in order to
get proper declaration for friend templates.

New macro __STL_NEW_FRIEND_TEMPLATES_DECL was
introduced. With __STL_NEW_FRIEND_TEMPLATES_DECL
undefined you'll get old SGI STL behavour.

The only thing which is not fixed is

friend rope identity_element(concat_fn);
 
in rope.h

i don't understand why identity_element
should depend on concat_fn at all.
Can someone put give a hint why
it's declared in such a way?
IMHO, it should be fixed.

regards

OK




diff --unified stlold/hash_map.h stl/hash_map.h
--- stlold/hash_map.h	Thu Aug 21 17:58:38 1997
+++ stl/hash_map.h	Sun Oct 26 22:43:23 1997
@@ -31,6 +31,23 @@
 #include <hashtable.h>
 #endif /* __SGI_STL_HASHTABLE_H */
 
+#ifdef __STL_NEW_FRIEND_TEMPLATES_DECL
+
+#ifndef __STL_LIMITED_DEFAULT_TEMPLATES
+template <class Key, class T, class HashFcn = hash<Key>,
+          class EqualKey = equal_to<Key>,
+          class Alloc = alloc>
+#else
+template <class Key, class T, class HashFcn, class EqualKey, 
+          class Alloc = alloc>
+#endif
+class hash_map;
+
+template <class Key, class T, class HashFcn, class EqualKey, class Alloc>
+bool operator==(const hash_map<Key, T, HashFcn, EqualKey, Alloc>& hm1,
+                const hash_map<Key, T, HashFcn, EqualKey, Alloc>& hm2);
+
+#endif /* __STL_NEW_FRIEND_TEMPLATES_DECL */
 
 #ifndef __STL_LIMITED_DEFAULT_TEMPLATES
 template <class Key, class T, class HashFcn = hash<Key>,
@@ -119,9 +136,16 @@
   size_type max_size() const { return rep.max_size(); }
   bool empty() const { return rep.empty(); }
   void swap(hash_map& hs) { rep.swap(hs.rep); }
+
+#ifdef __STL_NEW_FRIEND_TEMPLATES_DECL
+    
+  friend bool operator== <>(const hash_map<Key,T,HashFcn,EqualKey,Alloc>&,
+                            const hash_map<Key,T,HashFcn,EqualKey,Alloc>&);
+#else
   friend bool operator==(const hash_map<Key,T,HashFcn,EqualKey,Alloc>&,
                          const hash_map<Key,T,HashFcn,EqualKey,Alloc>&);
-
+#endif /* __STL_NEW_FRIEND_TEMPLATES_DECL */
+    
   iterator begin() { return rep.begin(); }
   iterator end() { return rep.end(); }
   const_iterator begin() const { return rep.begin(); }
@@ -177,6 +201,24 @@
   return hm1.rep == hm2.rep;
 }
 
+#ifdef __STL_NEW_FRIEND_TEMPLATES_DECL
+
+#ifndef __STL_LIMITED_DEFAULT_TEMPLATES
+template <class Key, class T, class HashFcn = hash<Key>,
+          class EqualKey = equal_to<Key>,
+          class Alloc = alloc>
+#else
+template <class Key, class T, class HashFcn, class EqualKey,
+          class Alloc = alloc>
+#endif
+class hash_multimap;
+
+template <class Key, class T, class HF, class EqKey, class Alloc>
+bool operator==(const hash_multimap<Key,T,HashFcn,EqualKey,Alloc>&,
+                const hash_multimap<Key,T,HashFcn,EqualKey,Alloc>&);
+
+#endif /* __STL_NEW_FRIEND_TEMPLATES_DECL */
+
 #ifndef __STL_LIMITED_DEFAULT_TEMPLATES
 template <class Key, class T, class HashFcn = hash<Key>,
           class EqualKey = equal_to<Key>,
@@ -264,9 +306,14 @@
   size_type max_size() const { return rep.max_size(); }
   bool empty() const { return rep.empty(); }
   void swap(hash_multimap& hs) { rep.swap(hs.rep); }
+#ifdef __STL_NEW_FRIEND_TEMPLATES_DECL    
+  friend bool operator== <>(const hash_multimap<Key,T,HashFcn,EqualKey,Alloc>&,
+                            const hash_multimap<Key,T,HashFcn,EqualKey,Alloc>&);
+#else
   friend bool operator==(const hash_multimap<Key,T,HashFcn,EqualKey,Alloc>&,
                          const hash_multimap<Key,T,HashFcn,EqualKey,Alloc>&);
-
+#endif /* __STL_NEW_FRIEND_TEMPLATES_DECL */
+    
   iterator begin() { return rep.begin(); }
   iterator end() { return rep.end(); }
   const_iterator begin() const { return rep.begin(); }
diff --unified stlold/hash_set.h stl/hash_set.h
--- stlold/hash_set.h	Thu Aug 21 17:58:38 1997
+++ stl/hash_set.h	Sun Oct 26 22:44:05 1997
@@ -31,6 +31,23 @@
 #include <hashtable.h>
 #endif /* __SGI_STL_HASHTABLE_H */
 
+#ifdef  __STL_NEW_FRIEND_TEMPLATES_DECL    
+
+#ifndef __STL_LIMITED_DEFAULT_TEMPLATES
+template <class Value, class HashFcn = hash<Value>,
+          class EqualKey = equal_to<Value>,
+          class Alloc = alloc>
+#else
+template <class Value, class HashFcn, class EqualKey, class Alloc = alloc>
+#endif
+class hash_set;
+
+template <class Value, class HashFcn, class EqualKey, class Alloc>
+bool operator==(const hash_set<Value, HashFcn, EqualKey, Alloc>& hs1,
+                const hash_set<Value, HashFcn, EqualKey, Alloc>& hs2);
+
+#endif /* __STL_NEW_FRIEND_TEMPLATES_DECL    */
+
 #ifndef __STL_LIMITED_DEFAULT_TEMPLATES
 template <class Value, class HashFcn = hash<Value>,
           class EqualKey = equal_to<Value>,
@@ -116,9 +133,13 @@
   size_type max_size() const { return rep.max_size(); }
   bool empty() const { return rep.empty(); }
   void swap(hash_set& hs) { rep.swap(hs.rep); }
+#ifdef  __STL_NEW_FRIEND_TEMPLATES_DECL    
+  friend bool operator== <>(const hash_set<Value,HashFcn,EqualKey,Alloc>&,
+                            const hash_set<Value,HashFcn,EqualKey,Alloc>&);
+#else
   friend bool operator==(const hash_set<Value,HashFcn,EqualKey,Alloc>&,
                          const hash_set<Value,HashFcn,EqualKey,Alloc>&);
-
+#endif /* __STL_NEW_FRIEND_TEMPLATES_DECL  */
   iterator begin() const { return rep.begin(); }
   iterator end() const { return rep.end(); }
 
@@ -170,6 +191,23 @@
   return hs1.rep == hs2.rep;
 }
 
+#ifdef __STL_NEW_FRIEND_TEMPLATES_DECL
+
+#ifndef __STL_LIMITED_DEFAULT_TEMPLATES
+template <class Value, class HashFcn = hash<Value>,
+          class EqualKey = equal_to<Value>,
+          class Alloc = alloc>
+#else
+template <class Value, class HashFcn, class EqualKey, class Alloc = alloc>
+#endif
+class hash_multiset;
+
+template <class Val, class HashFcn, class EqualKey, class Alloc>
+bool operator==(const hash_multiset<Val, HashFcn, EqualKey, Alloc>& hs1,
+                const hash_multiset<Val, HashFcn, EqualKey, Alloc>& hs2);
+  
+#endif /* __STL_NEW_FRIEND_TEMPLATES_DECL */
+
 #ifndef __STL_LIMITED_DEFAULT_TEMPLATES
 template <class Value, class HashFcn = hash<Value>,
           class EqualKey = equal_to<Value>,
@@ -255,9 +293,13 @@
   size_type max_size() const { return rep.max_size(); }
   bool empty() const { return rep.empty(); }
   void swap(hash_multiset& hs) { rep.swap(hs.rep); }
+#ifdef __STL_NEW_FRIEND_TEMPLATES_DECL
+  friend bool operator== <>(const hash_multiset<Value,HashFcn,EqualKey,Alloc>&,
+                            const hash_multiset<Value,HashFcn,EqualKey,Alloc>&);
+#else
   friend bool operator==(const hash_multiset<Value,HashFcn,EqualKey,Alloc>&,
                          const hash_multiset<Value,HashFcn,EqualKey,Alloc>&);
-
+#endif
   iterator begin() const { return rep.begin(); }
   iterator end() const { return rep.end(); }
 
diff --unified stlold/hashtable.h stl/hashtable.h
--- stlold/hashtable.h	Tue Sep  9 21:49:34 1997
+++ stl/hashtable.h	Sun Oct 26 12:46:57 1997
@@ -198,6 +198,18 @@
   return pos == last ? *(last - 1) : *pos;
 }
 
+#ifdef __STL_NEW_FRIEND_TEMPLATES_DECL    
+
+template <class Value, class Key, class HashFcn,
+          class ExtractKey, class EqualKey,
+          class Alloc>
+class hashtable;
+
+template <class V, class K, class HF, class Ex, class Eq, class A>
+bool operator==(const hashtable<V, K, HF, Ex, Eq, A>& ht1,
+                const hashtable<V, K, HF, Ex, Eq, A>& ht2);
+
+#endif /* __STL_NEW_FRIEND_TEMPLATES_DECL */
 
 template <class Value, class Key, class HashFcn,
           class ExtractKey, class EqualKey,
@@ -315,12 +327,21 @@
 
   const_iterator end() const { return const_iterator(0, this); }
 
+#ifdef __STL_NEW_FRIEND_TEMPLATES_DECL    
+  friend bool operator== <>(const hashtable<Value, Key,
+                                            HashFcn, ExtractKey, EqualKey,
+                                            Alloc>&,
+                            const hashtable<Value, Key,
+                                            HashFcn, ExtractKey, EqualKey,
+                                            Alloc>&);
+#else
   friend bool operator== (const hashtable<Value, Key,
                                           HashFcn, ExtractKey, EqualKey,
                                           Alloc>&,
                           const hashtable<Value, Key,
                                           HashFcn, ExtractKey, EqualKey,
                                           Alloc>&);
+#endif /* __STL_NEW_FRIEND_TEMPLATES_DECL    */
 
 public:
 
diff --unified stlold/iterator.h stl/iterator.h
--- stlold/iterator.h	Tue Sep  9 21:49:35 1997
+++ stl/iterator.h	Sun Oct 26 22:45:51 1997
@@ -340,6 +340,26 @@
   return insert_iterator<Container>(x, iter(i));
 }
 
+#ifdef __STL_NEW_FRIEND_TEMPLATES_DECL
+
+#ifndef __STL_LIMITED_DEFAULT_TEMPLATES
+template <class BidirectionalIterator, class T, class Reference = T&, 
+          class Distance = ptrdiff_t> 
+#else
+template <class BidirectionalIterator, class T, class Reference, 
+          class Distance> 
+#endif
+class reverse_bidirectional_iterator;
+
+template <class BidirectionalIterator, class T, class Reference, class Distance>
+bool operator==(
+    const reverse_bidirectional_iterator<BidirectionalIterator, T, Reference,
+                                         Distance>& x, 
+    const reverse_bidirectional_iterator<BidirectionalIterator, T, Reference,
+                                         Distance>& y);
+
+#endif /* __STL_NEW_FRIEND_TEMPLATES_DECL */
+
 #ifndef __STL_LIMITED_DEFAULT_TEMPLATES
 template <class BidirectionalIterator, class T, class Reference = T&, 
           class Distance = ptrdiff_t> 
@@ -350,7 +370,11 @@
 class reverse_bidirectional_iterator {
     typedef reverse_bidirectional_iterator<BidirectionalIterator, T, Reference,
                                            Distance> self;
+#ifdef __STL_NEW_FRIEND_TEMPLATES_DECL    
+    friend bool operator== <>(const self& x, const self& y);
+#else
     friend bool operator==(const self& x, const self& y);
+#endif
 protected:
     BidirectionalIterator current;
 public:
@@ -533,6 +557,43 @@
 // This is the old version of reverse_iterator, as found in the original
 //  HP STL.  It does not use partial specialization.
 
+#ifdef __STL_NEW_FRIEND_TEMPLATES_DECL
+
+#ifndef __STL_LIMITED_DEFAULT_TEMPLATES
+template <class RandomAccessIterator, class T, class Reference = T&,
+          class Distance = ptrdiff_t> 
+#else
+template <class RandomAccessIterator, class T, class Reference,
+          class Distance> 
+#endif
+class reverse_iterator;
+
+template <class RandomAccessIterator, class T, class Reference, class Distance>
+bool operator==(const reverse_iterator<RandomAccessIterator, T,
+                                       Reference, Distance>& x, 
+                const reverse_iterator<RandomAccessIterator, T,
+                                       Reference, Distance>& y);
+
+template <class RandomAccessIterator, class T, class Reference, class Distance>
+bool operator<(const reverse_iterator<RandomAccessIterator, T,
+                                      Reference, Distance>& x, 
+               const reverse_iterator<RandomAccessIterator, T,
+                                      Reference, Distance>& y);
+
+template <class RandomAccessIterator, class T, class Reference, class Distance>
+Distance operator-(const reverse_iterator<RandomAccessIterator, T,
+                                          Reference, Distance>& x, 
+                   const reverse_iterator<RandomAccessIterator, T,
+                                          Reference, Distance>& y);
+  
+template <class RandomAccessIterator, class T, class Reference, class Distance>
+reverse_iterator<RandomAccessIterator, T, Reference, Distance> 
+operator+(Distance n,
+          const reverse_iterator<RandomAccessIterator, T, Reference,
+                                 Distance>& x);
+  
+#endif /* __STL_NEW_FRIEND_TEMPLATES_DECL */
+
 #ifndef __STL_LIMITED_DEFAULT_TEMPLATES
 template <class RandomAccessIterator, class T, class Reference = T&,
           class Distance = ptrdiff_t> 
@@ -543,10 +604,17 @@
 class reverse_iterator {
     typedef reverse_iterator<RandomAccessIterator, T, Reference, Distance>
         self;
+#ifdef __STL_NEW_FRIEND_TEMPLATES_DECL
+    friend bool operator== <>(const self& x, const self& y);
+    friend bool operator< <>(const self& x, const self& y);
+    friend Distance operator- <>(const self& x, const self& y);
+    friend self operator+ <>(Distance n, const self& x);
+#else
     friend bool operator==(const self& x, const self& y);
     friend bool operator<(const self& x, const self& y);
     friend Distance operator-(const self& x, const self& y);
     friend self operator+(Distance n, const self& x);
+#endif /* __STL_NEW_FRIEND_TEMPLATES_DECL */
 protected:
     RandomAccessIterator current;
 public:
@@ -692,10 +760,27 @@
 
 #endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
 
+#ifdef __STL_NEW_FRIEND_TEMPLATES_DECL
+
+template <class T, class Distance = ptrdiff_t> 
+class istream_iterator;
+
+template <class T, class Distance>
+bool operator==(const istream_iterator<T, Distance>& x,
+                const istream_iterator<T, Distance>& y);
+
+#endif /* __STL_NEW_FRIEND_TEMPLATES_DECL */
+    
 template <class T, class Distance = ptrdiff_t> 
 class istream_iterator {
+#ifdef __STL_NEW_FRIEND_TEMPLATES_DECL
+friend bool operator== <>( const istream_iterator<T, Distance>& x,
+                           const istream_iterator<T, Distance>& y);
+#else
 friend bool operator==(const istream_iterator<T, Distance>& x,
                        const istream_iterator<T, Distance>& y);
+#endif /* __STL_NEW_FRIEND_TEMPLATES_DECL */
+    
 protected:
     istream* stream;
     T value;
diff --unified stlold/list.h stl/list.h
--- stlold/list.h	Tue Sep  9 21:49:36 1997
+++ stl/list.h	Sun Oct 26 22:46:23 1997
@@ -110,6 +110,16 @@
 
 #endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
 
+#ifdef __STL_NEW_FRIEND_TEMPLATES_DECL
+
+template <class T, class Alloc = alloc>
+class list;
+
+template <class T, class Alloc> bool
+operator==(const list<T,Alloc>& x, const list<T,Alloc>& y);
+
+#endif /* __STL_NEW_FRIEND_TEMPLATES_DECL */
+
 template <class T, class Alloc = alloc>
 class list {
 protected:
@@ -377,7 +387,11 @@
     template <class StrictWeakOrdering> void sort(StrictWeakOrdering);
 #endif /* __STL_MEMBER_TEMPLATES */
 
+#ifdef __STL_NEW_FRIEND_TEMPLATES_DECL
+    friend bool operator== <>(const list& x, const list& y);
+#else
     friend bool operator== (const list& x, const list& y);
+#endif /* __STL_NEW_FRIEND_TEMPLATES_DECL */
 };
 
 template <class T, class Alloc>
diff --unified stlold/map.h stl/map.h
--- stlold/map.h	Thu Aug 21 17:58:39 1997
+++ stl/map.h	Sun Oct 26 22:46:38 1997
@@ -29,6 +29,25 @@
 
 #include <tree.h>
 
+#ifdef __STL_NEW_FRIEND_TEMPLATES_DECL
+
+#ifndef __STL_LIMITED_DEFAULT_TEMPLATES
+template <class Key, class T, class Compare = less<Key>, class Alloc = alloc>
+#else
+template <class Key, class T, class Compare, class Alloc = alloc>
+#endif
+class map;
+
+template <class Key, class T, class Compare, class Alloc> bool
+operator==(const map<Key, T, Compare, Alloc>& x, 
+           const map<Key, T, Compare, Alloc>& y);
+
+template <class Key, class T, class Compare, class Alloc> bool
+operator<(const map<Key, T, Compare, Alloc>& x, 
+          const map<Key, T, Compare, Alloc>& y);
+
+#endif /* __STL_NEW_FRIEND_TEMPLATES_DECL */
+
 #ifndef __STL_LIMITED_DEFAULT_TEMPLATES
 template <class Key, class T, class Compare = less<Key>, class Alloc = alloc>
 #else
@@ -168,8 +187,13 @@
   pair<const_iterator,const_iterator> equal_range(const key_type& x) const {
     return t.equal_range(x);
   }
+#ifdef __STL_NEW_FRIEND_TEMPLATES_DECL
+  friend bool operator== <>(const map&, const map&);
+  friend bool operator< <>(const map&, const map&);
+#else
   friend bool operator==(const map&, const map&);
   friend bool operator<(const map&, const map&);
+#endif /* __STL_NEW_FRIEND_TEMPLATES_DECL */
 };
 
 template <class Key, class T, class Compare, class Alloc>
diff --unified stlold/multimap.h stl/multimap.h
--- stlold/multimap.h	Thu Aug 21 17:58:39 1997
+++ stl/multimap.h	Sun Oct 26 22:47:10 1997
@@ -29,6 +29,25 @@
 
 #include <tree.h>
 
+#ifdef __STL_NEW_FRIEND_TEMPLATES_DECL
+
+#ifndef __STL_LIMITED_DEFAULT_TEMPLATES
+template <class Key, class T, class Compare = less<Key>, class Alloc = alloc>
+#else
+template <class Key, class T, class Compare, class Alloc = alloc>
+#endif
+class multimap;
+
+template <class Key, class T, class Compare, class Alloc> bool
+operator==(const multimap<Key, T, Compare, Alloc>& x, 
+           const multimap<Key, T, Compare, Alloc>& y);
+
+template <class Key, class T, class Compare, class Alloc> bool
+operator<(const multimap<Key, T, Compare, Alloc>& x, 
+          const multimap<Key, T, Compare, Alloc>& y);
+
+#endif /* __STL_NEW_FRIEND_TEMPLATES_DECL */
+
 #ifndef __STL_LIMITED_DEFAULT_TEMPLATES
 template <class Key, class T, class Compare = less<Key>, class Alloc = alloc>
 #else
@@ -163,8 +182,13 @@
   pair<const_iterator,const_iterator> equal_range(const key_type& x) const {
     return t.equal_range(x);
   }
+#ifdef __STL_NEW_FRIEND_TEMPLATES_DECL
+  friend bool operator== <>(const multimap&, const multimap&);
+  friend bool operator< <>(const multimap&, const multimap&);
+#else
   friend bool operator==(const multimap&, const multimap&);
   friend bool operator<(const multimap&, const multimap&);
+#endif /* __STL_NEW_FRIEND_TEMPLATES_DECL */
 };
 
 template <class Key, class T, class Compare, class Alloc>
diff --unified stlold/multiset.h stl/multiset.h
--- stlold/multiset.h	Thu Aug 21 17:58:39 1997
+++ stl/multiset.h	Sun Oct 26 22:47:27 1997
@@ -29,6 +29,24 @@
 
 #include <tree.h>
 
+#ifdef __STL_NEW_FRIEND_TEMPLATES_DECL
+
+#ifndef __STL_LIMITED_DEFAULT_TEMPLATES
+template <class Key, class Compare = less<Key>, class Alloc = alloc>
+#else
+template <class Key, class Compare, class Alloc = alloc>
+#endif
+class multiset;
+
+template <class Key, class Compare, class Alloc> bool
+operator==(const multiset<Key, Compare, Alloc>& x, 
+           const multiset<Key, Compare, Alloc>& y);
+
+template <class Key, class Compare, class Alloc> bool
+operator<(const multiset<Key, Compare, Alloc>& x, 
+          const multiset<Key, Compare, Alloc>& y);
+#endif /* __STL_NEW_FRIEND_TEMPLATES_DECL */
+
 #ifndef __STL_LIMITED_DEFAULT_TEMPLATES
 template <class Key, class Compare = less<Key>, class Alloc = alloc>
 #else
@@ -148,8 +166,13 @@
   pair<iterator,iterator> equal_range(const key_type& x) const {
     return t.equal_range(x);
   }
+#ifdef __STL_NEW_FRIEND_TEMPLATES_DECL
+  friend bool operator== <>(const multiset&, const multiset&);
+  friend bool operator< <>(const multiset&, const multiset&);
+#else
   friend bool operator==(const multiset&, const multiset&);
   friend bool operator<(const multiset&, const multiset&);
+#endif /* __STL_NEW_FRIEND_TEMPLATES_DECL */
 };
 
 template <class Key, class Compare, class Alloc>
diff --unified stlold/rope.h stl/rope.h
--- stlold/rope.h	Tue Sep  9 21:49:40 1997
+++ stl/rope.h	Sun Oct 26 22:49:10 1997
@@ -564,6 +564,18 @@
     }
 };
 
+
+#ifdef __STL_NEW_FRIEND_TEMPLATES_DECL
+
+template<class charT, class Alloc> class __rope_charT_ptr_proxy;
+
+template <class charT, class Alloc> bool
+operator==(const __rope_charT_ptr_proxy<charT,Alloc> & x,
+           const __rope_charT_ptr_proxy<charT,Alloc> & y);
+
+#endif /* __STL_NEW_FRIEND_TEMPLATES_DECL */
+
+
 template<class charT, class Alloc>
 class __rope_charT_ptr_proxy {
     friend class __rope_charT_ref_proxy<charT,Alloc>;
@@ -589,9 +601,14 @@
 	root = x.root;
 	return *this;
     }
+#ifdef __STL_NEW_FRIEND_TEMPLATES_DECL
+    friend bool operator== <>(const __rope_charT_ptr_proxy<charT,Alloc> & x,
+                              const __rope_charT_ptr_proxy<charT,Alloc> & y);
+#else
     friend bool operator==
                 (const __rope_charT_ptr_proxy<charT,Alloc> & x,
                  const __rope_charT_ptr_proxy<charT,Alloc> & y);
+#endif /* __STL_NEW_FRIEND_TEMPLATES_DECL */
     __rope_charT_ref_proxy<charT,Alloc> operator *() const {
 	if (current_valid) {
 	    return __rope_charT_ref_proxy<charT,Alloc>(root, pos, current);
@@ -681,6 +698,33 @@
 
 template<class charT, class Alloc> class __rope_iterator;
 
+#ifdef __STL_NEW_FRIEND_TEMPLATES_DECL
+
+template<class charT, class Alloc> class __rope_const_iterator;
+
+template<class charT, class Alloc> __rope_const_iterator<charT,Alloc>
+operator- (const __rope_const_iterator<charT,Alloc> & x, ptrdiff_t n);
+
+template<class charT, class Alloc> __rope_const_iterator<charT,Alloc>
+operator+ (const __rope_const_iterator<charT,Alloc> & x, ptrdiff_t n);
+
+template<class charT, class Alloc> __rope_const_iterator<charT,Alloc>
+operator+ (ptrdiff_t n, const __rope_const_iterator<charT,Alloc> & x);
+
+template<class charT, class Alloc> bool
+operator== (const __rope_const_iterator<charT,Alloc> & x,
+            const __rope_const_iterator<charT,Alloc> & y);
+
+template<class charT, class Alloc> bool
+operator< (const __rope_const_iterator<charT,Alloc> & x,
+           const __rope_const_iterator<charT,Alloc> & y);
+
+template<class charT, class Alloc> ptrdiff_t
+operator- (const __rope_const_iterator<charT,Alloc> & x,
+	   const __rope_const_iterator<charT,Alloc> & y);
+
+#endif /* __STL_NEW_FRIEND_TEMPLATES_DECL */
+
 template<class charT, class Alloc>
 class __rope_const_iterator : public __rope_iterator_base<charT,Alloc> {
     friend class rope<charT,Alloc>;
@@ -760,6 +804,17 @@
 	decr(1);
 	return __rope_const_iterator<charT,Alloc>(root, old_pos);
     }
+#ifdef __STL_NEW_FRIEND_TEMPLATES_DECL
+    friend __rope_const_iterator<charT,Alloc> operator- <>
+	(const __rope_const_iterator<charT,Alloc> & x,
+	 ptrdiff_t n);
+    friend __rope_const_iterator<charT,Alloc> operator+ <>
+	(const __rope_const_iterator<charT,Alloc> & x,
+	 ptrdiff_t n);
+    friend __rope_const_iterator<charT,Alloc> operator+ <>
+	(ptrdiff_t n,
+	 const __rope_const_iterator<charT,Alloc> & x);
+#else
     friend __rope_const_iterator<charT,Alloc> operator-
 	(const __rope_const_iterator<charT,Alloc> & x,
 	 ptrdiff_t n);
@@ -769,9 +824,21 @@
     friend __rope_const_iterator<charT,Alloc> operator+
 	(ptrdiff_t n,
 	 const __rope_const_iterator<charT,Alloc> & x);
+#endif /* __STL_NEW_FRIEND_TEMPLATES_DECL */
     reference operator[](size_t n) {
 	return rope<charT,Alloc>::fetch(root, current_pos + n);
     }
+#ifdef __STL_NEW_FRIEND_TEMPLATES_DECL
+    friend bool
+    operator== <> (const __rope_const_iterator<charT,Alloc> & x,
+                   const __rope_const_iterator<charT,Alloc> & y);
+    friend bool
+    operator< <> (const __rope_const_iterator<charT,Alloc> & x,
+	          const __rope_const_iterator<charT,Alloc> & y);
+    friend ptrdiff_t
+    operator- <> (const __rope_const_iterator<charT,Alloc> & x,
+           	  const __rope_const_iterator<charT,Alloc> & y);
+#else
     friend bool operator==
 	(const __rope_const_iterator<charT,Alloc> & x,
 	 const __rope_const_iterator<charT,Alloc> & y);
@@ -781,8 +848,36 @@
     friend ptrdiff_t operator-
 	(const __rope_const_iterator<charT,Alloc> & x,
 	 const __rope_const_iterator<charT,Alloc> & y);
+#endif /* __STL_NEW_FRIEND_TEMPLATES_DECL */
 };
 
+#ifdef __STL_NEW_FRIEND_TEMPLATES_DECL
+
+template<class charT, class Alloc> class __rope_iterator;
+
+template<class charT, class Alloc> bool
+operator== (const __rope_iterator<charT,Alloc> & x,
+            const __rope_iterator<charT,Alloc> & y);
+
+template<class charT, class Alloc> bool
+operator< (const __rope_iterator<charT,Alloc> & x,
+	   const __rope_iterator<charT,Alloc> & y);
+
+template<class charT, class Alloc> ptrdiff_t
+operator- (const __rope_iterator<charT,Alloc> & x,
+	   const __rope_iterator<charT,Alloc> & y);
+
+template<class charT, class Alloc> __rope_iterator<charT,Alloc>
+operator- (const __rope_iterator<charT,Alloc> & x, ptrdiff_t n);
+
+template<class charT, class Alloc> __rope_iterator<charT,Alloc>
+operator+ (const __rope_iterator<charT,Alloc> & x, ptrdiff_t n);
+
+template<class charT, class Alloc> __rope_iterator<charT,Alloc>
+operator+ (ptrdiff_t n, const __rope_iterator<charT,Alloc> & x);
+
+#endif /* __STL_NEW_FRIEND_TEMPLATES_DECL */
+
 template<class charT, class Alloc>
 class __rope_iterator : public __rope_iterator_base<charT,Alloc> {
     friend class rope<charT,Alloc>;
@@ -880,6 +975,26 @@
     reference operator[](ptrdiff_t n) {
 	return __rope_charT_ref_proxy<charT,Alloc>(root_rope, current_pos + n);
     }
+#ifdef __STL_NEW_FRIEND_TEMPLATES_DECL
+    friend bool operator== <>
+	(const __rope_iterator<charT,Alloc> & x,
+	 const __rope_iterator<charT,Alloc> & y);
+    friend bool operator< <>
+	(const __rope_iterator<charT,Alloc> & x,
+	 const __rope_iterator<charT,Alloc> & y);
+    friend ptrdiff_t operator- <>
+	(const __rope_iterator<charT,Alloc> & x,
+	 const __rope_iterator<charT,Alloc> & y);
+    friend __rope_iterator<charT,Alloc> operator- <>
+	(const __rope_iterator<charT,Alloc> & x,
+	 ptrdiff_t n);
+    friend __rope_iterator<charT,Alloc> operator+ <>
+	(const __rope_iterator<charT,Alloc> & x,
+	 ptrdiff_t n);
+    friend __rope_iterator<charT,Alloc> operator+ <>
+	(ptrdiff_t n,
+	 const __rope_iterator<charT,Alloc> & x);
+#else
     friend bool operator==
 	(const __rope_iterator<charT,Alloc> & x,
 	 const __rope_iterator<charT,Alloc> & y);
@@ -898,9 +1013,26 @@
     friend __rope_iterator<charT,Alloc> operator+
 	(ptrdiff_t n,
 	 const __rope_iterator<charT,Alloc> & x);
+#endif /* __STL_NEW_FRIEND_TEMPLATES_DECL */
 
 };
 
+#ifdef __STL_NEW_FRIEND_TEMPLATES_DECL
+
+template <class charT, class Alloc>
+class rope;
+
+template <class charT, class Alloc> rope<charT,Alloc>
+operator+ (const rope<charT,Alloc> &left, const rope<charT,Alloc> &right);
+	
+template <class charT, class Alloc> rope<charT,Alloc>
+operator+ (const rope<charT,Alloc> &left, const charT* right);
+	
+template <class charT, class Alloc> rope<charT,Alloc>
+operator+ (const rope<charT,Alloc> &left, charT right);
+
+#endif /* __STL_NEW_FRIEND_TEMPLATES_DECL */
+
 template <class charT, class Alloc>
 class rope {
     public:
@@ -1472,6 +1604,17 @@
 	    return const_reverse_iterator(begin());
 	}
 
+#ifdef __STL_NEW_FRIEND_TEMPLATES_DECL
+
+	friend rope<charT,Alloc> operator+ <>(const rope<charT,Alloc> &left,
+					      const rope<charT,Alloc> &right);
+	
+	friend rope<charT,Alloc> operator+ <>(const rope<charT,Alloc> &left,
+					      const charT* right);
+	
+	friend rope<charT,Alloc> operator+ <>(const rope<charT,Alloc> &left,
+					      charT right);
+#else
 	friend rope<charT,Alloc> operator+ (const rope<charT,Alloc> &left,
 					    const rope<charT,Alloc> &right);
 	
@@ -1480,6 +1623,7 @@
 	
 	friend rope<charT,Alloc> operator+ (const rope<charT,Alloc> &left,
 					    charT right);
+#endif /* __STL_NEW_FRIEND_TEMPLATES_DECL */
 	
 	// The symmetric cases are intentionally omitted, since they're presumed
 	// to be less common, and we don't handle them as well.
diff --unified stlold/set.h stl/set.h
--- stlold/set.h	Thu Aug 21 17:58:40 1997
+++ stl/set.h	Sun Oct 26 22:49:25 1997
@@ -29,6 +29,24 @@
 
 #include <tree.h>
 
+#ifdef __STL_NEW_FRIEND_TEMPLATES_DECL
+
+#ifndef __STL_LIMITED_DEFAULT_TEMPLATES
+template <class Key, class Compare = less<Key>, class Alloc = alloc>
+#else
+template <class Key, class Compare, class Alloc = alloc>
+#endif
+class set;
+
+template <class Key, class Compare, class Alloc> bool
+operator==(const set<Key, Compare, Alloc>& x, 
+           const set<Key, Compare, Alloc>& y);
+
+template <class Key, class Compare, class Alloc> bool
+operator<(const set<Key, Compare, Alloc>& x, 
+          const set<Key, Compare, Alloc>& y);
+#endif /* __STL_NEW_FRIEND_TEMPLATES_DECL */
+
 #ifndef __STL_LIMITED_DEFAULT_TEMPLATES
 template <class Key, class Compare = less<Key>, class Alloc = alloc>
 #else
@@ -148,8 +166,13 @@
   pair<iterator,iterator> equal_range(const key_type& x) const {
     return t.equal_range(x);
   }
+#ifdef __STL_NEW_FRIEND_TEMPLATES_DECL
+  friend bool operator== <>(const set&, const set&);
+  friend bool operator< <>(const set&, const set&);
+#else
   friend bool operator==(const set&, const set&);
   friend bool operator<(const set&, const set&);
+#endif /* __STL_NEW_FRIEND_TEMPLATES_DECL */
 };
 
 template <class Key, class Compare, class Alloc>
diff --unified stlold/slist.h stl/slist.h
--- stlold/slist.h	Tue Sep  9 21:49:42 1997
+++ stl/slist.h	Sun Oct 26 22:49:53 1997
@@ -163,6 +163,15 @@
   return result;
 }
 
+#ifdef __STL_NEW_FRIEND_TEMPLATES_DECL
+
+template <class T, class Alloc = alloc> class slist;
+
+template <class T, class Alloc> bool
+operator==(const slist<T, Alloc>& L1, const slist<T, Alloc>& L2);
+
+#endif /* __STL_NEW_FRIEND_TEMPLATES_DECL */
+
 template <class T, class Alloc = alloc>
 class slist
 {
@@ -321,7 +330,11 @@
   }
 
 public:
+#ifdef __STL_NEW_FRIEND_TEMPLATES_DECL    
+  friend bool operator== <>(const slist<T, Alloc>& L1, const slist<T, Alloc>& L2);
+#else
   friend bool operator==(const slist<T, Alloc>& L1, const slist<T, Alloc>& L2);
+#endif /* __STL_NEW_FRIEND_TEMPLATES_DECL */
 
 public:
 
diff --unified stlold/stack.h stl/stack.h
--- stlold/stack.h	Thu Aug 21 17:58:40 1997
+++ stl/stack.h	Sun Oct 26 22:50:40 1997
@@ -32,16 +32,40 @@
 #include <vector.h>
 #include <deque.h>
 
+#ifdef __STL_NEW_FRIEND_TEMPLATES_DECL
+
+#ifndef __STL_LIMITED_DEFAULT_TEMPLATES
+template <class T, class Sequence = deque<T> >
+#else
+template <class T, class Sequence>
+#endif
+class stack;
+
+template <class T, class Sequence> bool
+operator==(const stack<T, Sequence>& x, const stack<T, Sequence>& y);
+
+template <class T, class Sequence> bool
+operator<(const stack<T, Sequence>& x, const stack<T, Sequence>& y);
+
+#endif /* __STL_NEW_FRIEND_TEMPLATES_DECL */
+
 #ifndef __STL_LIMITED_DEFAULT_TEMPLATES
 template <class T, class Sequence = deque<T> >
 #else
 template <class T, class Sequence>
 #endif
 class stack {
+#ifdef __STL_NEW_FRIEND_TEMPLATES_DECL
+  friend bool operator== <>(const stack<T, Sequence>& x,
+                            const stack<T, Sequence>& y);
+  friend bool operator< <>(const stack<T, Sequence>& x,
+                           const stack<T, Sequence>& y);
+#else    
   friend bool operator==(const stack<T, Sequence>& x,
                          const stack<T, Sequence>& y);
   friend bool operator<(const stack<T, Sequence>& x,
                         const stack<T, Sequence>& y);
+#endif /* __STL_NEW_FRIEND_TEMPLATES_DECL */
 public:
     typedef typename Sequence::value_type value_type;
     typedef typename Sequence::size_type size_type;
@@ -66,14 +90,36 @@
     return x.c < y.c;
 }
 
+#ifdef __STL_NEW_FRIEND_TEMPLATES_DECL
+
+#ifndef __STL_LIMITED_DEFAULT_TEMPLATES
+template <class T, class Sequence = deque<T> >
+#else
+template <class T, class Sequence>
+#endif
+class queue;
+
+template <class T, class Sequence> bool
+operator==(const queue<T, Sequence>& x, const queue<T, Sequence>& y);
+
+template <class T, class Sequence> bool
+operator<(const queue<T, Sequence>& x, const queue<T, Sequence>& y);
+
+#endif /* __STL_NEW_FRIEND_TEMPLATES_DECL */
+
 #ifndef __STL_LIMITED_DEFAULT_TEMPLATES
 template <class T, class Sequence = deque<T> >
 #else
 template <class T, class Sequence>
 #endif
 class queue {
+#ifdef __STL_NEW_FRIEND_TEMPLATES_DECL
+friend bool operator== <>(const queue<T, Sequence>& x, const queue<T, Sequence>& y);
+friend bool operator< <>(const queue<T, Sequence>& x, const queue<T, Sequence>& y);
+#else
 friend bool operator==(const queue<T, Sequence>& x, const queue<T, Sequence>& y);
 friend bool operator<(const queue<T, Sequence>& x, const queue<T, Sequence>& y);
+#endif /* __STL_NEW_FRIEND_TEMPLATES_DECL */
 public:
     typedef typename Sequence::value_type value_type;
     typedef typename Sequence::size_type size_type;
diff --unified stlold/stl_config.h stl/stl_config.h
--- stlold/stl_config.h	Tue Sep  9 21:49:43 1997
+++ stl/stl_config.h	Sun Oct 26 14:21:32 1997
@@ -91,6 +91,7 @@
 #   else
 #     define __STL_CLASS_PARTIAL_SPECIALIZATION
 #     define __STL_MEMBER_TEMPLATES
+#     define __STL_NEW_FRIEND_TEMPLATES_DECL
 #   endif
 #   ifdef __EXCEPTIONS
 #     define __STL_USE_EXCEPTIONS



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]