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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch] Qualify standard functions with std:: in stl_algo.h


Paolo Carlini <pcarlini@unitus.it> writes:

| Gabriel Dos Reis wrote:
| 
| >You're right.  Actually I meant "diff -p". Sorry for being a pain in
| >the ass.
| >
| ;) No problem...

Thank!,

| *************** namespace std
| *** 1243,1250 ****
|         typedef typename iterator_traits<_OutputIterator>::iterator_category _IterType;
|   
|         if (__first == __last) return __result;
| !       return __unique_copy(__first, __last,
| ! __result, __binary_pred, _IterType());
|       }
|   
|     /**
| --- 1243,1249 ----
|         typedef typename iterator_traits<_OutputIterator>::iterator_category _IterType;
|   
|         if (__first == __last) return __result;
| !       return __unique_copy(__first, __last, __result, __binary_pred, _IterType());

This should also be qualified -- even though the identifier is in the
implementor namespace.

[...]

| *************** __result, __binary_pred, _IterType());
| *** 1425,1431 ****
|   
|         _ForwardIterator __first2 = __middle;
|         do {
| ! 	swap(*__first++, *__first2++);
|   	if (__first == __middle)
|   	  __middle = __first2;
|         } while (__first2 != __last);
| --- 1424,1430 ----
|   
|         _ForwardIterator __first2 = __middle;
|         do {
| ! 	std::swap(*__first++, *__first2++);

This swap needs not be qualified.

swap has sort of become to have an operator-like status: It is
regarded as a fundamental operator.  In the EWG, we're exploring the
notion of "regular types", and swap is considered one of the
fundamental operations on those type.  We need to have them work
through ADL.


|   	if (__first == __middle)
|   	  __middle = __first2;
|         } while (__first2 != __last);
| *************** __result, __binary_pred, _IterType());
| *** 1433,1439 ****
|         __first2 = __middle;
|   
|         while (__first2 != __last) {
| ! 	swap(*__first++, *__first2++);

Same here.

[...]

| *** 1464,1470 ****
|         __reverse(__middle, __last,   bidirectional_iterator_tag());
|   
|         while (__first != __middle && __middle != __last)
| ! 	swap (*__first++, *--__last);

Ditto.

[...]

| *************** __result, __binary_pred, _IterType());
| *** 1692,1698 ****
|   
|         while (++__next != __last)
|   	if (__pred(*__next)) {
| ! 	  swap(*__first, *__next);

Ditto.


Apart from the above comments on swap, the patch is OK.  We also need
to document the fact that swap is a "point of customization" of our
implementaton. 

-- Gaby
 


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