Title
Qualification of placement new-expressions
Status
c++11
Section
[specialized.algorithms][util.smartptr.shared.create]
Submitter
Alberto Ganesh Barbati

Created on 2008-07-14.00:00:00 last changed 161 months ago

Messages

Date: 2010-10-21.18:28:33

Proposed resolution:

Replace "new" with "::new" in:

  • [uninitialized.copy], paragraphs 1 and 3
  • [uninitialized.fill] paragraph 1
  • [uninitialized.fill.n] paragraph 1
  • [util.smartptr.shared.create] once in paragraph 1 and twice in paragraph 2.
Date: 2010-10-21.18:28:33

[ post San Francisco: ]

Daniel: HasPlacementNew has been removed from N2774 (Foundational Concepts).

Date: 2010-10-21.18:28:33

[ San Francisco: ]

Detlef: If we move this to Ready, it's likely that we'll forget about the side comment about the HasPlacementNew concept.

Date: 2008-07-14.00:00:00

LWG issue 402 replaced "new" with "::new" in the placement new-expression in [allocator.members]. I believe the rationale given in 402 applies also to the following other contexts:

  • in [specialized.algorithms], all four algorithms unitialized_copy, unitialized_copy_n, unitialized_fill and unitialized_fill_n use the unqualified placement new-expression in some variation of the form:

    new  (static_cast<void*>(&*result)) typename  iterator_traits<ForwardIterator>::value_type(*first);
    
  • in [util.smartptr.shared.create] there is a reference to the unqualified placement new-expression:

    new  (pv)  T(std::forward<Args>(args)...),
    

I suggest to add qualification in all those places. As far as I know, these are all the remaining places in the whole library that explicitly use a placement new-expression. Should other uses come out, they should be qualified as well.

As an aside, a qualified placement new-expression does not need additional requirements to be compiled in a constrained context. By adding qualification, the HasPlacementNew concept introduced recently in N2677 (Foundational Concepts) would no longer be needed by library and should therefore be removed.

History
Date User Action Args
2011-08-23 20:07:26adminsetstatus: wp -> c++11
2010-10-21 18:28:33adminsetmessages: + msg4121
2010-10-21 18:28:33adminsetmessages: + msg4120
2010-10-21 18:28:33adminsetmessages: + msg4119
2008-07-14 00:00:00admincreate