[PATCH] D36423: [libc++] Introsort based sorting function

Ben Craig via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 8 18:56:01 PDT 2017

bcraig added a comment.

I like this change in general.  Dinkumware has been using introsort for 10+ years, so I'm a bit surprised that libc++ wasn't already.

Comment at: include/algorithm:4208
+  // Threshold(or depth limit) for introsort is taken to be 2*log2(size)
+  typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
This comment says basically the same thing as the code.  The comment would be more useful if it said why 2*log2(size) is used.


More information about the llvm-commits mailing list