[cfe-dev] error with lambda function that results in endless loop

Jean-Daniel Dupas devlists at shadowlab.org
Thu May 3 05:54:59 PDT 2012


Le 3 mai 2012 à 13:19, Florian Pflug a écrit :

> On May3, 2012, at 11:53 , Ran Regev wrote:
>> Surly returning true regardless of the value of the elements has no real meaning and can results in nonsense like a1<a2==true && a2<a1==true
>> And surly this is a bad idea to write code like this, but still - why it passes 30 and not 31?
> 
> Optimized sort implementations usually choose which algorithm to use based on the input length. This is done because the setup overhead of more sophisticated algorithms are often large enough to cause a net loss in performance for small inputs. In other words, a O(n*log(n)) algorithm may turn out to be slower than a O(n*n) algorithm if the former has a larger setup cost then the latter, and n is small.
> 
> best regards,
> Florian Pflug

According to the following presentation, libc++ is able to detect 8 different patterns when it sort a list:

http://llvm.org/devmtg/2010-11/Hinnant-libcxx.pdf

-- Jean-Daniel








More information about the cfe-dev mailing list