Boost logo

Boost :

From: Markus Schöpflin (markus.schoepflin_at_[hidden])
Date: 2002-10-01 08:13:25

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.

"test_allocator.cpp", line 3.20: 1540-0218 (S) The call does not match
any parameter list for "allocate".
"/usr/vacpp/include/xmemory", line 110.25: 1540-1283 (I) "template
<class _U> std::allocator<unsigned int>::allocate(size_type, const _U
*)" is not a viable candidate.
"/usr/vacpp/include/xmemory", line 112.17: 1540-1283 (I)
"std::allocator<unsigned int>::allocate(size_type)" is not a viable
"test_allocator.cpp", line 3.20: 1540-0215 (I) The wrong number of
arguments have been specified for "std::allocator<unsigned

It compiles the second line ok.


Boost list run by bdawes at, gregod at, cpdaniel at, john at