How to write an allocator for the STL List in VC++ 6.0

  • Thread starter =?ISO-8859-1?Q?Ralf_Schneewei=DF?=
  • Start date
?

=?ISO-8859-1?Q?Ralf_Schneewei=DF?=

Hi,
there is a book from Andre Wilms describing how to write allocators
for STL containers. Unfortunately the MS VC++ Compiler is not
supporting the full ANSI standard in the template part of the C++
programming language. This is the reason why the implementation
proposal of Wilms is not working with this compiler.
Is there anyone who knows a implementation proposal for an allocator
working with VC++?

Thanks

Ralf Schneeweiß

http:/www.oop-trainer.de
 
P

Pete Becker

Ralf said:
Hi,
there is a book from Andre Wilms describing how to write allocators
for STL containers. Unfortunately the MS VC++ Compiler is not
supporting the full ANSI standard in the template part of the C++
programming language. This is the reason why the implementation
proposal of Wilms is not working with this compiler.
Is there anyone who knows a implementation proposal for an allocator
working with VC++?

You need to provide a function named _Charalloc, because VC6 can't
handle the nested template that's used to rebind an allocator<T> to an
allocator<U>. Take a look at the VC++ header <xmemory> to see what
_Charalloc looks like.
 
S

Shane Beasley

Hi,
there is a book from Andre Wilms describing how to write allocators
for STL containers. Unfortunately the MS VC++ Compiler is not
supporting the full ANSI standard in the template part of the C++
programming language. This is the reason why the implementation
proposal of Wilms is not working with this compiler.
Is there anyone who knows a implementation proposal for an allocator
working with VC++?

(a) This is an ISO C++ newsgroup; Visual C++ questions like this one
would best be directed to a Visual C++ newsgroup (e.g.,
comp.os.ms-windows.programmer.*).

(b) If you open the header file "memory" in your Visual C++ include
directory (e.g., c:\program files\microsoft visual
studio\vc98\include), you will find that it refers to another header
("xmemory") in the same directory. In that file is defined the MSVC++6
allocator class. Just re-implement its interface.

- Shane
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,534
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top