Proposal for std::vector.

Dhruv Matani dhruvbird@gmx.net
Sat Feb 7 15:59:00 GMT 2004


On Sat, 2004-02-07 at 10:01, Dhruv Matani wrote:
> On Sat, 2004-02-07 at 00:26, Matt Austern wrote:

> 
> I have here these 2 test programs. One of them tries to emulate the
> vector (vtest.cpp), and the other one actually uses the vector. Now, the
> emulation produces (IMHO) correct output, but the one that uses the
> vector does not. I may be missing something somewhere, but I don't know
> where! I've basically tried to introduce a virtual clear() in the
> allocator and then call it in the deallocate function, but somehow the
> Allocator's clear() is being called instead of the vector's clear?

Ok, here is the correct thing! Which is wrong!!!



Here is the output:

[dhruv@localhost test]$ ./alloc_opt 
In ctor
In copy ctor
Calling My Clear -> Next Line Should be Whacky_Alloc::clear()
In Whacky_Alloc::clear()
Call Clear Now! Next Line should be blank which is wrong behaviour.

After Clear
Call Clear Now! Next Line should be blank which is wrong behaviour.

After Clear
Call Clear Now! Next Line should be blank which is wrong behaviour.

After Clear
Call Clear Now! Next Line should be blank which is wrong behaviour.

After Clear
Call Clear Now! Next Line should be blank which is wrong behaviour.

After Clear
Call Clear Now! Next Line should be blank which is wrong behaviour.
In Whacky_Alloc::clear()   <--- I can't still understand where this is
coming from?

After Clear
Calling My Clear -> Next Line Should be Whacky_Alloc::clear()
In Whacky_Alloc::clear()
All Clear
[dhruv@localhost test]$ 





-- 
	-Dhruv Matani.
http://www.geocities.com/dhruvbird/


-------------- next part --------------
A non-text attachment was scrubbed...
Name: alloc_opt.cpp
Type: text/x-c++
Size: 1375 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20040207/20d63897/attachment.bin>


More information about the Libstdc++ mailing list