|
Boost : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-10-01 08:26:44
From: "Markus Schöpflin" <markus.schoepflin_at_[hidden]>
> Peter Dimov wrote:
>
> > Excuse me for jumping in, but why is the check needed at all? Standard
> > allocators must support both forms of allocate().
>
> Hmm, good question. I didn't think about that before. I just noticed
> that it failed on my compiler (vacpp 5) and that the #ifdefs were
> obviously wrong.
>
> Wait a second... Aha, here is the problem. And from the fact that the
> #ifdef was there already I think there are other compilers that fail
> this as well.
>
> #include <memory>
> std::allocator<unsigned int> a;
> unsigned int *p = a.allocate(10, 0);
> //unsigned int *p = a.allocate<unsigned int>(10, 0);
>
> vacpp 5 fails to compile the first call to allocate because it can't
> figure out what type 0 is supposed to be.
Yes, this is Dinkumware 3.08 and below, I think.
unsigned int *p = a.allocate(10, (unsigned int *)0);
should be fine everywhere. Hopefully.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk