Farid Zaripov wrote:
From: Martin Sebor от имени Martin Sebor
Sent: Tue, 22.01.2008 18:20
To: [email protected]
Subject: Re: [PATCH] remove explicit casting to void* when calling 
allocator<>::allocate(size, pointer)

  The second parameter type is const_pointer, not 
malloc_allocator<void>::const_pointer.
As a result these tests are failed with the error:

Are you sure that the allocator is correct?
No. And I'll make the corresponding ticket in boost trac, but it's easier to fix problem at
our side (if it's possible) than wait until somebody from boost team fixes the 
problem in boost.
Another reason is succeeding of the such tests compiled with other STL's.

As long as we don't compromise the conformance or quality of our
implementation in the process.


[...]

IIRC, the cast to void* is there to make user-defined pointers work
but I don't think it's correct either. I can't think of any way to
solve this than to make allocate a template for allocators with
user-defined pointers:
But why in the list and tree classes explicit cast is used? Implicit cast to const void* should work.
Hint version of allocate() is also used in deque and vector, but without 
explicit cast to void*.

I'm not sure why. I don't like the casts so if they're not necessary
I'm all for removing them. To decide, I suspect we'll need to exercise
each of the containers with an allocator that encapsulates user-defined
pointer types.

I have this hazy recollection that I added at least one such test not
so long ago, and that the test had originally been a part of a bigger
test exercising all containers with user-defined pointers. The test
was failing because our list doesn't allow such things. I must be
hallucinating though because I can't find either the issue or the
test...

Martin


There's a test (20_allocator, I think) that we haven't migrated to
svn yet that exercises containers with allocators with user-defined
pointers. You might want to make sure it compiles with the changes
you're proposing.
Of course.

Farid.

Reply via email to