Topic: allocator <incomplete type> ?
Author: markus.mauhart@nospamm.chello.at ("Markus Mauhart")
Date: Mon, 9 Dec 2002 18:13:55 +0000 (UTC) Raw View
Hi,
AFAICS the standard is unclear whether a custom
allocater ALLOC<T> that shall be used with any
stdc++ library (-> 'stateless', pointer is T*)
shall allow things like ...
ALLOC<incomplete_type>::pointer p;
(typically coming from ...
ALLOC<known>::rebind<incomplete_type>::other::pointer)
Currently w.r.t. rebind<U>, 20.1.5,tbl31 says "U ... any
type". Maybe "U ... any complete type" ?
The problem is that even when ALLOC<T>::pointer is T* in
any case, ALLOC<T> might not 'compile' for incomplete T
(e.g. struct ALLOC<T>: IMPL<sizeof(T)> {...}).
The answer then decides whether one can build linked
nodes containing ALLOC<still_incomplete_node>::pointer.
One workaround could be requiring ...
ALLOC<known>::rebind<incomplete_type>::pointer
( ^ NO "::other")
OTOH a library that doesnt want to support other ::pointer's
than T* could easily use "still_incomplete_node*" instead of
ALLOC<known>::rebind<still_incomplete_node>::pointer.
BTW, for advanced allocators where alloc<T>::pointer really
needs a complete T, the design of nodes containing
alloc<node>::pointer will be interesting.
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 ]