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: Remove algo logic duplication Round 3


Hi,

FYI...

On 09/23/2013 10:07 PM, François Dumont wrote:
    /// Swaps the median value of *__a, *__b and *__c under __comp to *__a
    template<typename _Iterator, typename _Compare>
      void
      __move_median_first(_Iterator __a, _Iterator __b, _Iterator __c,
  			_Compare __comp)
      {
-      // concept requirements
-      __glibcxx_function_requires(_BinaryFunctionConcept<_Compare, bool,
-	    typename iterator_traits<_Iterator>::value_type,
-	    typename iterator_traits<_Iterator>::value_type>)
-
-      if (__comp(*__a, *__b))
+      if (__comp(__a, __b))
  	{
-	  if (__comp(*__b, *__c))
+	  if (__comp(__b, __c))
  	    std::iter_swap(__a, __b);
-	  else if (__comp(*__a, *__c))
+	  else if (__comp(__a, __c))
  	    std::iter_swap(__a, __c);
  	}
-      else if (__comp(*__a, *__c))
+      else if (__comp(__a, __c))
  	return;
-      else if (__comp(*__b, *__c))
+      else if (__comp(__b, __c))
  	std::iter_swap(__a, __c);
        else
  	std::iter_swap(__a, __b);
      }
Looks like something bad happened to this function: the changes to the __comp arguments can't be right. I'm going to fix it as part of applying Chris' patch. Please audit the rest of the patch for this kind of typo.

Paolo.


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