Boost logo

Boost :

Subject: Re: [boost] Offering sorted_vector for Boost, any interest?
From: Stewart, Robert (Robert.Stewart_at_[hidden])
Date: 2012-02-15 15:45:58


Robert Ramey wrote:
> Frank Birbacher wrote:
> >
> > I've come across lots of code that uses std::set where I
> > think a sorted vector would perform better. Those places a
> > characterized by:
> > 1. fills the set only once,
> > 2. just wants to drop duplicates or
> > 3. calls set::find very often.
> > Facing such code I often wished there was a ready to use
> > sorted_vector implementation.
>
> how would this be different than just
>
> a) using std::vector
> b) use std::sort to sort it
> c) use std::bsearch to find the element you're looking for
>
> I see no library here.

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.

_____
Rob Stewart robert.stewart_at_[hidden]
Software Engineer using std::disclaimer;
Dev Tools & Components
Susquehanna International Group, LLP http://www.sig.com

________________________________

IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.


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