allocator construct() / destruct() behaviour...

pippadav@dei.unipd.it pippadav@dei.unipd.it
Mon Jul 19 16:25:00 GMT 2004


Hi everybody !

There's a behaviour in STL allocator I don't understand, I hope somebody can 
help me...

I'm trying to customize an allocator to track the insertion/deletion of objects 
in a container,
decorating the standard allocator functions construct() and destroy(). 

The problem is that it seems that those functions are never called in STL 
containers, instead
a global template function _Construct() (defined in <stl_construct.h>) is 
called, that is
completely unaware of allocators. 

Is this the supposed behaviour ? So, what is the utility of those construct()
/destroy() functions ?
Is there a way to achieve a similar functionality ?

Thanks for any help ! :)

ps: I attached the source and the output of the simple test allocator I did, as 
you
can see from the output construct() and destroy() are never called...

Pyper.




-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: alloc_test.cpp
Type: application/octet-stream
Size: 2578 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20040719/4b67b1c9/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: alloc_test.out
Type: application/octet-stream
Size: 763 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20040719/4b67b1c9/attachment-0001.obj>


More information about the Libstdc++ mailing list