|
Boost : |
From: David Abrahams (abrahams_at_[hidden])
Date: 2000-12-27 00:30:02
I have posted binary searching code to the boost files area at
http://www.egroups.com/files/boost/Binary+Search/. The .zip file contains:
boost/boost/detail/iterator.hpp, containing:
boost::detail::iterator_traits<>
std::iterator_traits, unless you need value_type, even for
nonconforming compilers
boost::detail::distance()
std::distance(), even for nonconforming compilers
boost/boost/binary_search.hpp
a derivative of the binary search functions in SGI STL, but using cleaner
workarounds for nonconforming compilers
boost/libs/utility/binary_search_test.hpp
Test code for verifying the above functionality
The text files, binary_search1.txt and binary_search2.txt are derived from
my postings on the subject and will form the basis for the formal
documentation.
-Dave
P.S. Jeremy, I think I understand now why you want a relationship between
binary searching and sortedness: what does it mean to search for an
insertion position? I believe this just requires some theorem proving but no
additional standard language. Let's talk.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk