The standard was finalized in 1998 with fixes in 2003, whereas boost::addressof
dates to early 2002.
Moreover, it's not clear that addressof
is the answer. Overloads of operator&()
indicate that raw pointers are supposed to be avoided. The Allocator::address
member provides the best interface to get from Allocator::reference
to Allocator::pointer
, so in general theory, you should be able to effectively introduce an operator&
override to an otherwise well-behaved class with a custom allocator.
Considering that references do almost everything that pointers do, and the Allocator interface abstracts everything else, there should be no need for raw pointers.
Convenience to the library implementers should not be an issue. The ill-defined semantics of Allocator::pointer
are a problem, and what I've read so far in C++0x doesn't clear that up.
C++0x removes any mention of operator&
from CopyConstructible, and furthermore doesn't require anything-Constructible for container arguments at all — the user can stick to emplace
. Even vector
only requires Destructible, although I suppose actually using insert
or erase
would require more.
(Note that, in the strictest reading, overloads are not forbidden in C++03. You are just not allowed to change the value or type of the builtin.)