
Michael Stevens wrote:
GCC is correct. There is a get out clause in the library standard. Look at section 20.1.5 "Allocator requirements" paragraph 4:
Implementations of containers described in this International Standard are permitted to assume that their Allocator template parameter meets the following two additional requirements beyond those in Table 32. All instances of a given allocator type are required to be interchangeable and always compare equal to each other. The typedef members pointer, const_pointer, size_type, and difference_type are required to be T*, T const*, size_t, and ptrdiff_t, respectively.
I suspect many implementation (including those not in the standard) have this requirement!
Dinkumware's library doesn't. It is certainly something to strive for when writing a container, since otherwise your container cannot be used with certain useful allocators. Tom