Boost logo

Boost :

Subject: Re: [boost] Offering sorted_vector for Boost, any interest?
From: Nathan Ridge (zeratul976_at_[hidden])
Date: 2012-02-15 16:42:13


> From: ramey_at_[hidden]
>
> 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.

Well, if you drop the requirement of having to work properly, I suppose
anything can be written in 15 lines ;)

Regards,
Nate
                                               


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk