From 7ffb61d5030d7299320beb9b16978a66d6513d86 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Thu, 21 Sep 2006 17:54:50 +0000 Subject: [PATCH] hash_map: Remove forward declaration of equality operator... 2006-09-21 Paolo Carlini * include/ext/hash_map: Remove forward declaration of equality operator, not needed for friendship of all its instances. * include/ext/hash_set: Likewise. * include/bits/stl_set.h: Likewise for equality operator and operator less. * include/bits/stl_multiset.h: Likewise. * include/bits/stl_multimap.h: Likewise. * include/bits/stl_queue.h: Likewise. * include/bits/stl_stack.h: Likewise. * include/bits/streambuf_iterator.h: Likewise for copy. * include/std/std_streambuf.h: Likewise for __copy_aux and find. * include/tr1/boost_shared_ptr.h: Likewise for get_deleter. * include/tr1/random: Likewise, remove all forward declarations of inserters and extractors. From-SVN: r117116 --- libstdc++-v3/ChangeLog | 17 ++ libstdc++-v3/include/bits/stl_multimap.h | 21 +- libstdc++-v3/include/bits/stl_multiset.h | 18 +- libstdc++-v3/include/bits/stl_queue.h | 14 +- libstdc++-v3/include/bits/stl_set.h | 18 +- libstdc++-v3/include/bits/stl_stack.h | 15 +- .../include/bits/streambuf_iterator.h | 6 - libstdc++-v3/include/ext/hash_map | 31 +-- libstdc++-v3/include/ext/hash_set | 32 +-- libstdc++-v3/include/std/std_streambuf.h | 12 - libstdc++-v3/include/tr1/boost_shared_ptr.h | 5 - libstdc++-v3/include/tr1/random | 205 ------------------ 12 files changed, 39 insertions(+), 355 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index ca26e47959b..e85e75a6131 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,20 @@ +2006-09-21 Paolo Carlini + + * include/ext/hash_map: Remove forward declaration of equality + operator, not needed for friendship of all its instances. + * include/ext/hash_set: Likewise. + * include/bits/stl_set.h: Likewise for equality operator and + operator less. + * include/bits/stl_multiset.h: Likewise. + * include/bits/stl_multimap.h: Likewise. + * include/bits/stl_queue.h: Likewise. + * include/bits/stl_stack.h: Likewise. + * include/bits/streambuf_iterator.h: Likewise for copy. + * include/std/std_streambuf.h: Likewise for __copy_aux and find. + * include/tr1/boost_shared_ptr.h: Likewise for get_deleter. + * include/tr1/random: Likewise, remove all forward declarations + of inserters and extractors. + 2006-09-21 Paolo Carlini * include/ext/sso_string_base.h (__sso_string_base<>::_M_max_size(), diff --git a/libstdc++-v3/include/bits/stl_multimap.h b/libstdc++-v3/include/bits/stl_multimap.h index 41e93a2ef30..b11b6e409d5 100644 --- a/libstdc++-v3/include/bits/stl_multimap.h +++ b/libstdc++-v3/include/bits/stl_multimap.h @@ -65,23 +65,6 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD) - // Forward declaration of operators < and ==, needed for friend declaration. - - template , - typename _Alloc = std::allocator > > - class multimap; - - template - inline bool - operator==(const multimap<_Key, _Tp, _Compare, _Alloc>& __x, - const multimap<_Key, _Tp, _Compare, _Alloc>& __y); - - template - inline bool - operator<(const multimap<_Key, _Tp, _Compare, _Alloc>& __x, - const multimap<_Key, _Tp, _Compare, _Alloc>& __y); - /** * @brief A standard container made up of (key,value) pairs, which can be * retrieved based on a key, in logarithmic time. @@ -103,7 +86,9 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD) * called (*_unique versus *_equal, same as the standard). * @endif */ - template + template , + typename _Alloc = std::allocator > > class multimap { public: diff --git a/libstdc++-v3/include/bits/stl_multiset.h b/libstdc++-v3/include/bits/stl_multiset.h index dd6e976117c..8c499c3690f 100644 --- a/libstdc++-v3/include/bits/stl_multiset.h +++ b/libstdc++-v3/include/bits/stl_multiset.h @@ -65,21 +65,6 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD) - // Forward declaration of operators < and ==, needed for friend declaration. - template , - class _Alloc = std::allocator<_Key> > - class multiset; - - template - inline bool - operator==(const multiset<_Key, _Compare, _Alloc>& __x, - const multiset<_Key, _Compare, _Alloc>& __y); - - template - inline bool - operator<(const multiset<_Key, _Compare, _Alloc>& __x, - const multiset<_Key, _Compare, _Alloc>& __y); - /** * @brief A standard container made up of elements, which can be retrieved * in logarithmic time. @@ -100,7 +85,8 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD) * called (*_unique versus *_equal, same as the standard). * @endif */ - template + template , + class _Alloc = std::allocator<_Key> > class multiset { // concept requirements diff --git a/libstdc++-v3/include/bits/stl_queue.h b/libstdc++-v3/include/bits/stl_queue.h index 84c003540ed..04e3a7b46e0 100644 --- a/libstdc++-v3/include/bits/stl_queue.h +++ b/libstdc++-v3/include/bits/stl_queue.h @@ -67,18 +67,6 @@ _GLIBCXX_BEGIN_NAMESPACE(std) - // Forward declarations of operators < and ==, needed for friend declaration. - template > - class queue; - - template - inline bool - operator==(const queue<_Tp, _Seq>&, const queue<_Tp, _Seq>&); - - template - inline bool - operator<(const queue<_Tp, _Seq>&, const queue<_Tp, _Seq>&); - /** * @brief A standard container giving FIFO behavior. * @@ -103,7 +91,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) * which is a typedef for the second Sequence parameter, and @c push and * @c pop, which are standard %queue/FIFO operations. */ - template + template > class queue { // concept requirements diff --git a/libstdc++-v3/include/bits/stl_set.h b/libstdc++-v3/include/bits/stl_set.h index ed362f13c1e..b61106aef65 100644 --- a/libstdc++-v3/include/bits/stl_set.h +++ b/libstdc++-v3/include/bits/stl_set.h @@ -65,21 +65,6 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD) - // Forward declarations of operators < and ==, needed for friend declaration. - template, - class _Alloc = std::allocator<_Key> > - class set; - - template - inline bool - operator==(const set<_Key, _Compare, _Alloc>& __x, - const set<_Key, _Compare, _Alloc>& __y); - - template - inline bool - operator<(const set<_Key, _Compare, _Alloc>& __x, - const set<_Key, _Compare, _Alloc>& __y); - /** * @brief A standard container made up of unique keys, which can be * retrieved in logarithmic time. @@ -103,7 +88,8 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD) * called (*_unique versus *_equal, same as the standard). * @endif */ - template + template, + class _Alloc = std::allocator<_Key> > class set { // concept requirements diff --git a/libstdc++-v3/include/bits/stl_stack.h b/libstdc++-v3/include/bits/stl_stack.h index a6b5533f563..f5b41facb03 100644 --- a/libstdc++-v3/include/bits/stl_stack.h +++ b/libstdc++-v3/include/bits/stl_stack.h @@ -67,19 +67,6 @@ _GLIBCXX_BEGIN_NAMESPACE(std) - // Forward declarations of operators == and <, needed for friend - // declaration. - template > - class stack; - - template - inline bool - operator==(const stack<_Tp, _Seq>& __x, const stack<_Tp, _Seq>& __y); - - template - inline bool - operator<(const stack<_Tp, _Seq>& __x, const stack<_Tp, _Seq>& __y); - /** * @brief A standard container giving FILO behavior. * @@ -107,7 +94,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) * push, @c pop, and @c top, which are standard %stack/FILO * operations. */ - template + template > class stack { // concept requirements diff --git a/libstdc++-v3/include/bits/streambuf_iterator.h b/libstdc++-v3/include/bits/streambuf_iterator.h index 8c76013d324..a1cf234a387 100644 --- a/libstdc++-v3/include/bits/streambuf_iterator.h +++ b/libstdc++-v3/include/bits/streambuf_iterator.h @@ -43,12 +43,6 @@ _GLIBCXX_BEGIN_NAMESPACE(std) - template - typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, - ostreambuf_iterator<_CharT> >::__type - copy(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, - ostreambuf_iterator<_CharT>); - // 24.5.3 Template class istreambuf_iterator /// Provides input iterator semantics for streambufs. template diff --git a/libstdc++-v3/include/ext/hash_map b/libstdc++-v3/include/ext/hash_map index 2367c77415e..b6855ebb3be 100644 --- a/libstdc++-v3/include/ext/hash_map +++ b/libstdc++-v3/include/ext/hash_map @@ -72,23 +72,13 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(__gnu_cxx, _GLIBCXX_EXT) using std::pair; using std::_Select1st; - // Forward declaration of equality operator; needed for friend - // declaration. - template, - class _EqualKey = equal_to<_Key>, class _Alloc = allocator<_Tp> > - class hash_map; - - template - inline bool - operator==(const hash_map<_Key, _Tp, _HashFn, _EqKey, _Alloc>&, - const hash_map<_Key, _Tp, _HashFn, _EqKey, _Alloc>&); - /** * This is an SGI extension. * @ingroup SGIextensions * @doctodo */ - template + template, + class _EqualKey = equal_to<_Key>, class _Alloc = allocator<_Tp> > class hash_map { private: @@ -295,25 +285,16 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(__gnu_cxx, _GLIBCXX_EXT) hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm2) { __hm1.swap(__hm2); } - // Forward declaration of equality operator; needed for friend declaration. - template, - class _EqualKey = equal_to<_Key>, - class _Alloc = allocator<_Tp> > - class hash_multimap; - - template - inline bool - operator==(const hash_multimap<_Key, _Tp, _HF, _EqKey, _Alloc>& __hm1, - const hash_multimap<_Key, _Tp, _HF, _EqKey, _Alloc>& __hm2); /** * This is an SGI extension. * @ingroup SGIextensions * @doctodo */ - template + template, + class _EqualKey = equal_to<_Key>, + class _Alloc = allocator<_Tp> > class hash_multimap { // concept requirements diff --git a/libstdc++-v3/include/ext/hash_set b/libstdc++-v3/include/ext/hash_set index 02cc99fb96e..668fe13bd2a 100644 --- a/libstdc++-v3/include/ext/hash_set +++ b/libstdc++-v3/include/ext/hash_set @@ -72,24 +72,14 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(__gnu_cxx, _GLIBCXX_EXT) using std::pair; using std::_Identity; - // Forward declaration of equality operator; needed for friend - // declaration. - template, - class _EqualKey = equal_to<_Value>, - class _Alloc = allocator<_Value> > - class hash_set; - - template - inline bool - operator==(const hash_set<_Value, _HashFcn, _EqualKey, _Alloc>& __hs1, - const hash_set<_Value, _HashFcn, _EqualKey, _Alloc>& __hs2); - /** * This is an SGI extension. * @ingroup SGIextensions * @doctodo */ - template + template, + class _EqualKey = equal_to<_Value>, + class _Alloc = allocator<_Value> > class hash_set { // concept requirements @@ -285,24 +275,16 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(__gnu_cxx, _GLIBCXX_EXT) hash_set<_Val, _HashFcn, _EqualKey, _Alloc>& __hs2) { __hs1.swap(__hs2); } - template, - class _EqualKey = equal_to<_Value>, - class _Alloc = allocator<_Value> > - class hash_multiset; - - template - inline bool - operator==(const hash_multiset<_Val, _HashFcn, _EqualKey, _Alloc>& __hs1, - const hash_multiset<_Val, _HashFcn, _EqualKey, _Alloc>& __hs2); - /** * This is an SGI extension. * @ingroup SGIextensions * @doctodo */ - template + template, + class _EqualKey = equal_to<_Value>, + class _Alloc = allocator<_Value> > class hash_multiset { // concept requirements diff --git a/libstdc++-v3/include/std/std_streambuf.h b/libstdc++-v3/include/std/std_streambuf.h index 5a5ca869289..67ffaf335f6 100644 --- a/libstdc++-v3/include/std/std_streambuf.h +++ b/libstdc++-v3/include/std/std_streambuf.h @@ -60,18 +60,6 @@ _GLIBCXX_BEGIN_NAMESPACE(std) __copy_streambufs_eof(basic_streambuf<_CharT, _Traits>*, basic_streambuf<_CharT, _Traits>*, bool&); - template - typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, - _CharT*>::__type - __copy_aux(istreambuf_iterator<_CharT>, - istreambuf_iterator<_CharT>, _CharT*); - - template - typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, - istreambuf_iterator<_CharT> >::__type - find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, - const _CharT&); - /** * @brief The actual work of input and output (interface). * diff --git a/libstdc++-v3/include/tr1/boost_shared_ptr.h b/libstdc++-v3/include/tr1/boost_shared_ptr.h index dfe5f171b6d..bc8028d08c7 100644 --- a/libstdc++-v3/include/tr1/boost_shared_ptr.h +++ b/libstdc++-v3/include/tr1/boost_shared_ptr.h @@ -483,11 +483,6 @@ template<_Lock_policy _Lp> { } -// Function get_deleter must be declared before friend declaration by -// shared_ptr. -template - _Del* get_deleter(const __shared_ptr<_Tp, _Lp>&); - /** * @class shared_ptr * diff --git a/libstdc++-v3/include/tr1/random b/libstdc++-v3/include/tr1/random index b926c5bf439..05286ee17dd 100644 --- a/libstdc++-v3/include/tr1/random +++ b/libstdc++-v3/include/tr1/random @@ -295,21 +295,6 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) * * The size of the state is @f$ 1 @f$. */ - template - class linear_congruential; - - template - std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const linear_congruential<_UIntType, __a, __c, __m>& __lcr); - - template - std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, - linear_congruential<_UIntType, __a, __c, __m>& __lcr); - template class linear_congruential { @@ -503,29 +488,6 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) * @var output_c The second left-shift tempering matrix mask. * @var output_l The second right-shift tempering matrix parameter. */ - template - class mersenne_twister; - - template - std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const mersenne_twister<_UIntType, __w, __n, __m, - __r, __a, __u, __s, __b, __t, __c, __l>& __x); - - template - std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, - mersenne_twister<_UIntType, __w, __n, __m, - __r, __a, __u, __s, __b, __t, __c, __l>& __x); - template @@ -706,21 +668,6 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) * @var _M_p Current index of x(i - r). * @endif */ - template - class subtract_with_carry; - - template - std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const subtract_with_carry<_IntType, __m, __s, __r>& __x); - - template - std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, - subtract_with_carry<_IntType, __m, __s, __r>& __x); - template class subtract_with_carry { @@ -898,21 +845,6 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) * @var _M_npows Precomputed negative powers of 2. * @endif */ - template - class subtract_with_carry_01; - - template - std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const subtract_with_carry_01<_RealType, __w, __s, __r>& __x); - - template - std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, - subtract_with_carry_01<_RealType, __w, __s, __r>& __x); - template class subtract_with_carry_01 { @@ -1104,22 +1036,6 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) * * 0 <= @p __r <= @p __p */ - template - class discard_block; - - template - std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const discard_block<_UniformRandomNumberGenerator, - __p, __r>& __x); - - template - std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, - discard_block<_UniformRandomNumberGenerator, __p, __r>& __x); - template class discard_block { @@ -1325,26 +1241,6 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) * A random number generator adaptor class that combines two random number * generator engines into a single output sequence. */ - template - class xor_combine; - - template - std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const xor_combine<_UniformRandomNumberGenerator1, __s1, - _UniformRandomNumberGenerator2, __s2>& __x); - - template - std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, - xor_combine<_UniformRandomNumberGenerator1, __s1, - _UniformRandomNumberGenerator2, __s2>& __x); - template class xor_combine @@ -1616,19 +1512,6 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) * probability throughout the range. */ template - class uniform_int; - - template - std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const uniform_int<_IntType>& __x); - - template - std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, - uniform_int<_IntType>& __x); - - template class uniform_int { __glibcxx_class_requires(_IntType, _IntegerConcept) @@ -1758,13 +1641,6 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) * Generates a sequence of true and false values with likelihood @f$ p @f$ * that true will come up and @f$ (1 - p) @f$ that false will appear. */ - class bernoulli_distribution; - - template - std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const bernoulli_distribution& __x); - class bernoulli_distribution { public: @@ -1855,15 +1731,6 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) * distribution. */ template - class geometric_distribution; - - template - std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const geometric_distribution<_IntType, _RealType>& __x); - - template class geometric_distribution { public: @@ -1951,21 +1818,6 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) * parameter of the distribution. */ template - class poisson_distribution; - - template - std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const poisson_distribution<_IntType, _RealType>& __x); - - template - std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, - poisson_distribution<_IntType, _RealType>& __x); - - template class poisson_distribution { public: @@ -2053,21 +1905,6 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) * and @f$ p @f$ are the parameters of the distribution. */ template - class binomial_distribution; - - template - std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const binomial_distribution<_IntType, _RealType>& __x); - - template - std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, - binomial_distribution<_IntType, _RealType>& __x); - - template class binomial_distribution { public: @@ -2176,19 +2013,6 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) * deliver number in the range [0, 1). */ template - class uniform_real; - - template - std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const uniform_real<_RealType>& __x); - - template - std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, - uniform_real<_RealType>& __x); - - template class uniform_real { public: @@ -2278,14 +2102,6 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) * */ template - class exponential_distribution; - - template - std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const exponential_distribution<_RealType>& __x); - - template class exponential_distribution { public: @@ -2369,19 +2185,6 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) * e^{- \frac{{x - mean}^ {2}}{2 \sigma ^ {2}} } @f$. */ template - class normal_distribution; - - template - std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const normal_distribution<_RealType>& __x); - - template - std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, - normal_distribution<_RealType>& __x); - - template class normal_distribution { public: @@ -2471,14 +2274,6 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) * @f$ p(x) = \frac{1}{\Gamma(\alpha)} x^{\alpha - 1} e^{-x} } @f$. */ template - class gamma_distribution; - - template - std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const gamma_distribution<_RealType>& __x); - - template class gamma_distribution { public: -- 2.30.2