Here is my published reusable c++ code, which includes a version of a sorted vector that I’ve been using for years. It may not be academically sterile C++, I’m more interested in getting things done, and I had to crank out some new functionality needed for my upcoming media manager. But it should be solid production code. It glues together std::vector with std::sort, std::lower_bound, etc., which is a pretty fscking logical thing to do – who wants to redo that every time you have data to manage? :> My favorite part is the find_it_or_fail() function, the only real extension of functionality. Basically, it extends lower_bound() in a logical way, so you either get a hit, or failure (indicated by returning vector::end()). There are also versions of member functions with predicate function parameters, to help you use it with vectors of object pointers, which isn’t exactly straightforward in C++. Let me know if it seems useful or sucky. :>

Reusable STLContainers code
old wiki copy of sorted_vector

Leave a Reply