That's not what this means. The 'new' operator here uses the
standard
placement form, which does no allocation, but uses the given address
(result) as the pointer value, invoking the copy constructor
(value_type(*first)) on it. This is indeed the desired behavior.
Yes, sorry. From what I see (cf. 12.14.13), one may have to define
void* operator new(size_t, void* p) { return p; }
Or is it in the standard?
It is standard:
18.4.1.3: Placement forms
These functions are reserved, a C++ program may not define functions
that displace the versions in the Standard C++ library (17.4.3).
void* operator new(std::size_t size, void* ptr) throw();
Not surprising, really, since the function does nothing whatever
except
return ptr (calling the copy constructor is part of the semantics of
the
'new' expression, as opposed to this operator).