Proposal for std::vector.

Gabriel Dos Reis gdr@integrable-solutions.net
Tue Feb 10 09:44:00 GMT 2004


Dhruv Matani <dhruvbird@gmx.net> writes:

| On Tue, 2004-02-10 at 10:23, Matt Austern wrote:
| > On Feb 9, 2004, at 6:20 PM, Gabriel Dos Reis wrote:
| > 
| > > Matt Austern <austern@apple.com> writes:
| > >
| > > | I'm afraid you're right too.  Fortunately, I really do only mean "a
| > > | bit" more
| > > | complicated.  The solution is pretty simple: instead of inheriting
| > > | directly
| > > | from the allocator, instead inherit from a thin wrapper class that
| > > | provides
| > > | nothing but the allocator functions we care about.
| > >
| > >
| > > Just to make sure I understand your suggestion.  In doing so, how do
| > > we prevent the "virtual function is a sin you inherit from your
| > > descendents" syndrom and benefit at the same time from the empty base
| > > optimization?
| > >
| > > The solution I'm thinking of would be:
| > >
| > >   template<class Allocator>
| > >     WrapAllocator {
| > >        Allocator allocator;
| 
| How would this aid EBO?

I'm not sure, that is why I asked the question.  I'm under the
impression that it would remove that opportunity, but Matt is more
expert about this than I. 

| IMHO, the good things about EBO would be lost as soon as the member
| variable is introduced.

-- Gaby



More information about the Libstdc++ mailing list