[Patch] Qualify with std:: two files

Martin Sebor sebor@roguewave.com
Thu Jul 3 16:57:00 GMT 2003


Paolo Carlini wrote:

> Hi,
...
> 2003-07-03  Paolo Carlini  <pcarlini@unitus.it>
> 
> 	* include/bits/stl_function.h: Fully qualify standard
> 	functions with std::, thus avoiding Koenig lookup.

Just an observation: the patch also qualifies a whole bunch of
types (such as unary_negate) in addition to functions. That's
not really necessary because Koenig lookup finds only functions.

Regards
Martin

> 	* include/bits/stl_heap.h: Likewise.
> 
> 
> ------------------------------------------------------------------------
> 
> diff -cprN libstdc++-v3-orig/include/bits/stl_function.h libstdc++-v3/include/bits/stl_function.h
> *** libstdc++-v3-orig/include/bits/stl_function.h	Sun Jan  6 10:14:15 2002
> --- libstdc++-v3/include/bits/stl_function.h	Thu Jul  3 18:09:46 2003
> *************** template <class _Predicate>
> *** 285,291 ****
>   inline unary_negate<_Predicate> 
>   not1(const _Predicate& __pred)
>   {
> !   return unary_negate<_Predicate>(__pred);
>   }
>   
>   /// One of the @link s20_3_5_negators negation functors@endlink.
> --- 285,291 ----
>   inline unary_negate<_Predicate> 
>   not1(const _Predicate& __pred)
>   {
> !   return std::unary_negate<_Predicate>(__pred);
>   }
>   
>   /// One of the @link s20_3_5_negators negation functors@endlink.
> *************** template <class _Predicate>
> *** 310,316 ****
>   inline binary_negate<_Predicate> 
>   not2(const _Predicate& __pred)
>   {
> !   return binary_negate<_Predicate>(__pred);
>   }
>   /** @}  */
>   
> --- 310,316 ----
>   inline binary_negate<_Predicate> 
>   not2(const _Predicate& __pred)
>   {
> !   return std::binary_negate<_Predicate>(__pred);
>   }
>   /** @}  */
>   
> *************** inline binder1st<_Operation> 
> *** 376,382 ****
>   bind1st(const _Operation& __fn, const _Tp& __x) 
>   {
>     typedef typename _Operation::first_argument_type _Arg1_type;
> !   return binder1st<_Operation>(__fn, _Arg1_type(__x));
>   }
>   
>   /// One of the @link s20_3_6_binder binder functors@endlink.
> --- 376,382 ----
>   bind1st(const _Operation& __fn, const _Tp& __x) 
>   {
>     typedef typename _Operation::first_argument_type _Arg1_type;
> !   return std::binder1st<_Operation>(__fn, _Arg1_type(__x));
>   }
>   
>   /// One of the @link s20_3_6_binder binder functors@endlink.
> *************** inline binder2nd<_Operation> 
> *** 410,416 ****
>   bind2nd(const _Operation& __fn, const _Tp& __x) 
>   {
>     typedef typename _Operation::second_argument_type _Arg2_type;
> !   return binder2nd<_Operation>(__fn, _Arg2_type(__x));
>   }
>   /** @}  */
>   
> --- 410,416 ----
>   bind2nd(const _Operation& __fn, const _Tp& __x) 
>   {
>     typedef typename _Operation::second_argument_type _Arg2_type;
> !   return std::binder2nd<_Operation>(__fn, _Arg2_type(__x));
>   }
>   /** @}  */
>   
> *************** public:
> *** 449,455 ****
>   template <class _Arg, class _Result>
>   inline pointer_to_unary_function<_Arg, _Result> ptr_fun(_Result (*__x)(_Arg))
>   {
> !   return pointer_to_unary_function<_Arg, _Result>(__x);
>   }
>   
>   /// One of the @link s20_3_7_adaptors adaptors for function pointers@endlink.
> --- 449,455 ----
>   template <class _Arg, class _Result>
>   inline pointer_to_unary_function<_Arg, _Result> ptr_fun(_Result (*__x)(_Arg))
>   {
> !   return std::pointer_to_unary_function<_Arg, _Result>(__x);
>   }
>   
>   /// One of the @link s20_3_7_adaptors adaptors for function pointers@endlink.
> *************** public:
> *** 471,477 ****
>   template <class _Arg1, class _Arg2, class _Result>
>   inline pointer_to_binary_function<_Arg1,_Arg2,_Result> 
>   ptr_fun(_Result (*__x)(_Arg1, _Arg2)) {
> !   return pointer_to_binary_function<_Arg1,_Arg2,_Result>(__x);
>   }
>   /** @}  */
>   
> --- 471,477 ----
>   template <class _Arg1, class _Arg2, class _Result>
>   inline pointer_to_binary_function<_Arg1,_Arg2,_Result> 
>   ptr_fun(_Result (*__x)(_Arg1, _Arg2)) {
> !   return std::pointer_to_binary_function<_Arg1,_Arg2,_Result>(__x);
>   }
>   /** @}  */
>   
> *************** private:
> *** 694,729 ****
>   
>   template <class _Ret, class _Tp>
>   inline mem_fun_t<_Ret,_Tp> mem_fun(_Ret (_Tp::*__f)())
> !   { return mem_fun_t<_Ret,_Tp>(__f); }
>   
>   template <class _Ret, class _Tp>
>   inline const_mem_fun_t<_Ret,_Tp> mem_fun(_Ret (_Tp::*__f)() const)
> !   { return const_mem_fun_t<_Ret,_Tp>(__f); }
>   
>   template <class _Ret, class _Tp>
>   inline mem_fun_ref_t<_Ret,_Tp> mem_fun_ref(_Ret (_Tp::*__f)()) 
> !   { return mem_fun_ref_t<_Ret,_Tp>(__f); }
>   
>   template <class _Ret, class _Tp>
>   inline const_mem_fun_ref_t<_Ret,_Tp> mem_fun_ref(_Ret (_Tp::*__f)() const)
> !   { return const_mem_fun_ref_t<_Ret,_Tp>(__f); }
>   
>   template <class _Ret, class _Tp, class _Arg>
>   inline mem_fun1_t<_Ret,_Tp,_Arg> mem_fun(_Ret (_Tp::*__f)(_Arg))
> !   { return mem_fun1_t<_Ret,_Tp,_Arg>(__f); }
>   
>   template <class _Ret, class _Tp, class _Arg>
>   inline const_mem_fun1_t<_Ret,_Tp,_Arg> mem_fun(_Ret (_Tp::*__f)(_Arg) const)
> !   { return const_mem_fun1_t<_Ret,_Tp,_Arg>(__f); }
>   
>   template <class _Ret, class _Tp, class _Arg>
>   inline mem_fun1_ref_t<_Ret,_Tp,_Arg> mem_fun_ref(_Ret (_Tp::*__f)(_Arg))
> !   { return mem_fun1_ref_t<_Ret,_Tp,_Arg>(__f); }
>   
>   template <class _Ret, class _Tp, class _Arg>
>   inline const_mem_fun1_ref_t<_Ret,_Tp,_Arg>
>   mem_fun_ref(_Ret (_Tp::*__f)(_Arg) const)
> !   { return const_mem_fun1_ref_t<_Ret,_Tp,_Arg>(__f); }
>   
>   /** @}  */
>   
> --- 694,729 ----
>   
>   template <class _Ret, class _Tp>
>   inline mem_fun_t<_Ret,_Tp> mem_fun(_Ret (_Tp::*__f)())
> !   { return std::mem_fun_t<_Ret,_Tp>(__f); }
>   
>   template <class _Ret, class _Tp>
>   inline const_mem_fun_t<_Ret,_Tp> mem_fun(_Ret (_Tp::*__f)() const)
> !   { return std::const_mem_fun_t<_Ret,_Tp>(__f); }
>   
>   template <class _Ret, class _Tp>
>   inline mem_fun_ref_t<_Ret,_Tp> mem_fun_ref(_Ret (_Tp::*__f)()) 
> !   { return std::mem_fun_ref_t<_Ret,_Tp>(__f); }
>   
>   template <class _Ret, class _Tp>
>   inline const_mem_fun_ref_t<_Ret,_Tp> mem_fun_ref(_Ret (_Tp::*__f)() const)
> !   { return std::const_mem_fun_ref_t<_Ret,_Tp>(__f); }
>   
>   template <class _Ret, class _Tp, class _Arg>
>   inline mem_fun1_t<_Ret,_Tp,_Arg> mem_fun(_Ret (_Tp::*__f)(_Arg))
> !   { return std::mem_fun1_t<_Ret,_Tp,_Arg>(__f); }
>   
>   template <class _Ret, class _Tp, class _Arg>
>   inline const_mem_fun1_t<_Ret,_Tp,_Arg> mem_fun(_Ret (_Tp::*__f)(_Arg) const)
> !   { return std::const_mem_fun1_t<_Ret,_Tp,_Arg>(__f); }
>   
>   template <class _Ret, class _Tp, class _Arg>
>   inline mem_fun1_ref_t<_Ret,_Tp,_Arg> mem_fun_ref(_Ret (_Tp::*__f)(_Arg))
> !   { return std::mem_fun1_ref_t<_Ret,_Tp,_Arg>(__f); }
>   
>   template <class _Ret, class _Tp, class _Arg>
>   inline const_mem_fun1_ref_t<_Ret,_Tp,_Arg>
>   mem_fun_ref(_Ret (_Tp::*__f)(_Arg) const)
> !   { return std::const_mem_fun1_ref_t<_Ret,_Tp,_Arg>(__f); }
>   
>   /** @}  */
>   
> diff -cprN libstdc++-v3-orig/include/bits/stl_heap.h libstdc++-v3/include/bits/stl_heap.h
> *** libstdc++-v3-orig/include/bits/stl_heap.h	Fri Nov  2 18:38:11 2001
> --- libstdc++-v3/include/bits/stl_heap.h	Thu Jul  3 18:11:54 2003
> *************** namespace std
> *** 93,100 ****
>   	    _RandomAccessIterator>)
>         __glibcpp_function_requires(_LessThanComparableConcept<_ValueType>)
>   
> !       __push_heap(__first, _DistanceType((__last - __first) - 1), _DistanceType(0), 
> ! 		  _ValueType(*(__last - 1)));
>       }
>   
>     template<typename _RandomAccessIterator, typename _Distance, typename _Tp, 
> --- 93,100 ----
>   	    _RandomAccessIterator>)
>         __glibcpp_function_requires(_LessThanComparableConcept<_ValueType>)
>   
> !       std::__push_heap(__first, _DistanceType((__last - __first) - 1), _DistanceType(0), 
> ! 		       _ValueType(*(__last - 1)));
>       }
>   
>     template<typename _RandomAccessIterator, typename _Distance, typename _Tp, 
> *************** namespace std
> *** 126,133 ****
>         __glibcpp_function_requires(_Mutable_RandomAccessIteratorConcept<
>   	    _RandomAccessIterator>)
>   
> !       __push_heap(__first, _DistanceType((__last - __first) - 1), _DistanceType(0), 
> ! 		  _ValueType(*(__last - 1)), __comp);
>       }
>   
>     template<typename _RandomAccessIterator, typename _Distance, typename _Tp>
> --- 126,133 ----
>         __glibcpp_function_requires(_Mutable_RandomAccessIteratorConcept<
>   	    _RandomAccessIterator>)
>   
> !       std::__push_heap(__first, _DistanceType((__last - __first) - 1), _DistanceType(0), 
> ! 		       _ValueType(*(__last - 1)), __comp);
>       }
>   
>     template<typename _RandomAccessIterator, typename _Distance, typename _Tp>
> *************** namespace std
> *** 148,154 ****
>   	*(__first + __holeIndex) = *(__first + (__secondChild - 1));
>   	__holeIndex = __secondChild - 1;
>         }
> !       __push_heap(__first, __holeIndex, __topIndex, __value);
>       }
>   
>     template<typename _RandomAccessIterator, typename _Tp>
> --- 148,154 ----
>   	*(__first + __holeIndex) = *(__first + (__secondChild - 1));
>   	__holeIndex = __secondChild - 1;
>         }
> !       std::__push_heap(__first, __holeIndex, __topIndex, __value);
>       }
>   
>     template<typename _RandomAccessIterator, typename _Tp>
> *************** namespace std
> *** 158,164 ****
>       {
>         typedef typename iterator_traits<_RandomAccessIterator>::difference_type _Distance;
>         *__result = *__first;
> !       __adjust_heap(__first, _Distance(0), _Distance(__last - __first), __value);
>       }
>   
>     template<typename _RandomAccessIterator>
> --- 158,164 ----
>       {
>         typedef typename iterator_traits<_RandomAccessIterator>::difference_type _Distance;
>         *__result = *__first;
> !       std::__adjust_heap(__first, _Distance(0), _Distance(__last - __first), __value);
>       }
>   
>     template<typename _RandomAccessIterator>
> *************** namespace std
> *** 172,178 ****
>   	    _RandomAccessIterator>)
>         __glibcpp_function_requires(_LessThanComparableConcept<_ValueType>)
>   
> !       __pop_heap(__first, __last - 1, __last - 1, _ValueType(*(__last - 1)));
>       }
>   
>     template<typename _RandomAccessIterator, typename _Distance,
> --- 172,178 ----
>   	    _RandomAccessIterator>)
>         __glibcpp_function_requires(_LessThanComparableConcept<_ValueType>)
>   
> !       std::__pop_heap(__first, __last - 1, __last - 1, _ValueType(*(__last - 1)));
>       }
>   
>     template<typename _RandomAccessIterator, typename _Distance,
> *************** namespace std
> *** 194,200 ****
>   	*(__first + __holeIndex) = *(__first + (__secondChild - 1));
>   	__holeIndex = __secondChild - 1;
>         }
> !       __push_heap(__first, __holeIndex, __topIndex, __value, __comp);
>       }
>   
>     template<typename _RandomAccessIterator, typename _Tp, typename _Compare>
> --- 194,200 ----
>   	*(__first + __holeIndex) = *(__first + (__secondChild - 1));
>   	__holeIndex = __secondChild - 1;
>         }
> !       std::__push_heap(__first, __holeIndex, __topIndex, __value, __comp);
>       }
>   
>     template<typename _RandomAccessIterator, typename _Tp, typename _Compare>
> *************** namespace std
> *** 204,211 ****
>       {
>         typedef typename iterator_traits<_RandomAccessIterator>::difference_type _Distance;
>         *__result = *__first;
> !       __adjust_heap(__first, _Distance(0), _Distance(__last - __first), 
> ! 		    __value, __comp);
>       }
>   
>     template<typename _RandomAccessIterator, typename _Compare>
> --- 204,211 ----
>       {
>         typedef typename iterator_traits<_RandomAccessIterator>::difference_type _Distance;
>         *__result = *__first;
> !       std::__adjust_heap(__first, _Distance(0), _Distance(__last - __first), 
> ! 			 __value, __comp);
>       }
>   
>     template<typename _RandomAccessIterator, typename _Compare>
> *************** namespace std
> *** 218,224 ****
>   	    _RandomAccessIterator>)
>   
>         typedef typename iterator_traits<_RandomAccessIterator>::value_type _ValueType;
> !       __pop_heap(__first, __last - 1, __last - 1, _ValueType(*(__last - 1)), __comp);
>       }
>   
>     template<typename _RandomAccessIterator>
> --- 218,224 ----
>   	    _RandomAccessIterator>)
>   
>         typedef typename iterator_traits<_RandomAccessIterator>::value_type _ValueType;
> !       std::__pop_heap(__first, __last - 1, __last - 1, _ValueType(*(__last - 1)), __comp);
>       }
>   
>     template<typename _RandomAccessIterator>
> *************** namespace std
> *** 240,246 ****
>         _DistanceType __parent = (__len - 2)/2;
>   	
>         while (true) {
> ! 	__adjust_heap(__first, __parent, __len, _ValueType(*(__first + __parent)));
>   	if (__parent == 0) return;
>   	__parent--;
>         }
> --- 240,246 ----
>         _DistanceType __parent = (__len - 2)/2;
>   	
>         while (true) {
> ! 	std::__adjust_heap(__first, __parent, __len, _ValueType(*(__first + __parent)));
>   	if (__parent == 0) return;
>   	__parent--;
>         }
> *************** namespace std
> *** 265,272 ****
>         _DistanceType __parent = (__len - 2)/2;
>   	
>         while (true) {
> ! 	__adjust_heap(__first, __parent, __len,
> ! 	              _ValueType(*(__first + __parent)), __comp);
>   	if (__parent == 0) return;
>   	__parent--;
>         }
> --- 265,272 ----
>         _DistanceType __parent = (__len - 2)/2;
>   	
>         while (true) {
> ! 	std::__adjust_heap(__first, __parent, __len,
> ! 			   _ValueType(*(__first + __parent)), __comp);
>   	if (__parent == 0) return;
>   	__parent--;
>         }
> *************** namespace std
> *** 283,289 ****
>   	    typename iterator_traits<_RandomAccessIterator>::value_type>)
>   
>         while (__last - __first > 1)
> ! 	pop_heap(__first, __last--);
>       }
>   
>     template<typename _RandomAccessIterator, typename _Compare>
> --- 283,289 ----
>   	    typename iterator_traits<_RandomAccessIterator>::value_type>)
>   
>         while (__last - __first > 1)
> ! 	std::pop_heap(__first, __last--);
>       }
>   
>     template<typename _RandomAccessIterator, typename _Compare>
> *************** namespace std
> *** 296,302 ****
>   	    _RandomAccessIterator>)
>   
>         while (__last - __first > 1)
> ! 	pop_heap(__first, __last--, __comp);
>       }
>   
>   } // namespace std
> --- 296,302 ----
>   	    _RandomAccessIterator>)
>   
>         while (__last - __first > 1)
> ! 	std::pop_heap(__first, __last--, __comp);
>       }
>   
>   } // namespace std




More information about the Libstdc++ mailing list