Topic: Allocator not calling new, was: delete of const objects o.k.?
Author: James.Kanze@dresdner-bank.com
Date: 1999/09/15 Raw View
In article <slrn7trsa1.uk7.sbnaran@localhost.localdomain>,
sbnaran@uiuc.edu wrote:
> To find space for 3 elements, the container calls the default
> allocator's allocate function. In template form, it is
>
> T * allocator<T>::allocate(size_type N) {
> return static_cast<T *>(std::malloc(N*sizeof(T)));
> }
Is this implementation legal. In 20.4.1.1, it says (concerning
allocate): "Uses ::operator new(size_t)". This would seem to forbid a
direct call to malloc. On the other hand, this text is in a field
called Notes (but it is not marked as a note normally is): is it
normative? And if not, why do the notes say something that the standard
doesn't guarantee?
--
James Kanze mailto: James.Kanze@dresdner-bank.com
Conseils en informatique orient e objet/
Beratung in objekt orientierter Datenverarbeitung
Ziegelh ttenweg 17a, 60598 Frankfurt, Germany Tel. +49(069)63198627
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]