Topic: casts in table 32 [lib.allocator.requirements]
Author: markus.mauhart@nospamm.chello.at ("Markus Mauhart")
Date: Fri, 15 Nov 2002 20:01:33 +0000 (UTC) Raw View
IMHO the last two lines of the table 32 have surprising
effects, could be typos.
Prerequisits:
alloc<T> a ;// an allocator for T
alloc<T>::pointer p ;// random access iterator
// (may be different from T*)
alloc<T>::reference r = *p;// T&
T& t ;
Table 32:
a.construct(p,t) Effect: new((void*)p) T(t)
a.destroy(p) Effect: ((T*)p) ->~T()
This would require then a user-defined conversion to T*
for all alloc<T>::pointer, and new might involve
T::operator new(..).
Is this interpretation correct and intended ?
I had expected simpler effects like ...
::new ((void*)&*p) T(t)
p->~T() <=> (*p).~T() <=> (&*p)->~T()
Thanks,
Markus.
---
[ 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://www.jamesd.demon.co.uk/csc/faq.html ]