Boost logo

Boost :

From: Rainer Deyke (root_at_[hidden])
Date: 2002-01-08 23:57:06

----- Original Message -----
From: "David Abrahams" <david.abrahams_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Tuesday, January 08, 2002 5:51 PM
Subject: Re: [boost] Re: Proposal: Sorted Vector Container

> ----- Original Message -----
> From: "Rainer Deyke" <root_at_[hidden]>
> > > 3. Sorted vector of pointers to values.
> >
> > Given that the most common object in a container is already a (smart)
> > pointer, I see nothing this extra level of indirection buys anyone.
> A transparent drop-in replacement for tree-based associative containers
> applications where pointer/reference stability is important.

Granted. Still, this drop-in replacement should not compromise the design
of what is basically a new container. The price of a pointer-based
conatiner (at least one extra pointer per element, one extra indirection per
access) may be unacceptably high in some cases.

> Also, a way to
> keep the same data in different sort orders without copying it.

There already is a way: use a container of pointers. A container of
pointers can even store (pointers to) instances of subclasses, which makes
containers of pointers a very common idiom. Encapsulating this idiom in a
class may make sense, but encapsulating a non-polymorphic version of this
idiom in a class makes less sense and tying this class to a specific
container makes even less sense.

Rainer Deyke (root_at_[hidden])
Shareware computer games           - 
"In ihren Reihen zu stehen heisst unter Feinden zu kaempfen" - Abigor

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