This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of Dup status.

479. Container requirements and placement new

Section: 24.2 [container.requirements] Status: Dup Submitter: Herb Sutter Opened: 2004-08-01 Last modified: 2016-01-28

Priority: Not Prioritized

View all other issues in [container.requirements].

View all issues with Dup status.

Duplicate of: 580


Nothing in the standard appears to make this program ill-formed:

  struct C {
    void* operator new( size_t s ) { return ::operator new( s ); }
    // NOTE: this hides in-place and nothrow new

  int main() {
    vector<C> v;
    v.push_back( C() );

Is that intentional? We should clarify whether or not we intended to require containers to support types that define their own special versions of operator new.

[ Lillehammer: A container will definitely never use this overridden operator new, but whether it will fail to compile is unclear from the standard. Are containers supposed to use qualified or unqualified placement new? is somewhat relevant, but the standard doesn't make it completely clear whether containers have to use Allocator::construct(). If containers don't use it, the details of how containers use placement new are unspecified. That is the real bug, but it needs to be fixed as part of the allocator overhaul. Weak support that the eventual solution should make this code well formed. ]

Proposed resolution: