[llvm] r178376 - [docs] The STL "binary search" has a non-obvious name.

Sean Silva silvas at purdue.edu
Fri Mar 29 14:57:48 PDT 2013


Author: silvas
Date: Fri Mar 29 16:57:47 2013
New Revision: 178376

URL: http://llvm.org/viewvc/llvm-project?rev=178376&view=rev
Log:
[docs] The STL "binary search" has a non-obvious name.

std::lower_bound is the canonical "binary search" in the STL
(std::binary_search generally is not what you want). The name actually
makes a lot of sense (and also has a beautiful symmetry with the
std::upper_bound algorithm). The name is nonetheless non-obvious.

Also, remove mention of "radix search". It's not even clear how that
would work in the context of a sorted vector. AFAIK "radix search" only
makes sense when you have a trie-like data structure.

Modified:
    llvm/trunk/docs/ProgrammersManual.rst

Modified: llvm/trunk/docs/ProgrammersManual.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ProgrammersManual.rst?rev=178376&r1=178375&r2=178376&view=diff
==============================================================================
--- llvm/trunk/docs/ProgrammersManual.rst (original)
+++ llvm/trunk/docs/ProgrammersManual.rst Fri Mar 29 16:57:47 2013
@@ -1016,7 +1016,9 @@ coupled with a good choice of :ref:`sequ
 This combination provides the several nice properties: the result data is
 contiguous in memory (good for cache locality), has few allocations, is easy to
 address (iterators in the final vector are just indices or pointers), and can be
-efficiently queried with a standard binary or radix search.
+efficiently queried with a standard binary search (e.g.
+``std::lower_bound``; if you want the whole range of elements comparing
+equal, use ``std::equal_range``).
 
 .. _dss_smallset:
 





More information about the llvm-commits mailing list