Boost logo

Boost :

Subject: Re: [boost] Offering sorted_vector for Boost, any interest?
From: Robert Ramey (ramey_at_[hidden])
Date: 2012-02-15 16:27:38

Stewart, Robert wrote:
> You need to check your vision! Seriously, others have mentioned
> flat_set already, but the point is that using std::sort and the other
> algorithms is not reusable. You must use them, and use them
> correctly, every time you want the behavior, and you must be sure to
> use them at the right time. That's the essence of the need for a
> library: provide a reusable component for non-trivial functionality.

I guess the issue is - what's trivial. It seems to that something like:

// some comments here
template<class T, class A>
class fast_set : public std::vector<T, A> {
    const T & find(const T & t){
        static bool sorted = false;
        if(! sorted){
            std::sort(begin(), end());
            sorted = true;
        std::vector<T, A>::find(t);

is pretty simple. Certainly simpler than documentation, header, tests
etc required to make it a library. Any one who needs this as a package
can easily make this as a 15 line header file.

Some things are just to simple and obvious to need a library.

Robert Ramey

Boost list run by bdawes at, gregod at, cpdaniel at, john at