Section: 26.11 [specialized.algorithms] Status: New Submitter: Alisdair Meredith Opened: 2018-02-12 Last modified: 2020-05-02
Priority: 3
View other active issues in [specialized.algorithms].
View all other issues in [specialized.algorithms].
View all issues with New status.
Discussion:
A typical specification of the algorithms for initializing raw memory in <memory>
looks like:
Effects: Equivalent to:
for (; first != last; ++first) ::new (static_cast<void*>(addressof(*first))) typename iterator_traits<ForwardIterator>::value_type;
However, this hides a nasty question:
How do we bind a reference to an uninitialized object when dereferencing our iterator, so thatstatic_cast<void*>(addressof(*first))
does not trigger undefined behavior on
the call to *first
?
When pointers are the only iterators we cared about, we could simply cast the iterator
value to void*
without dereferencing. I don't see how to implement this spec safely
without introducing another customization point for iterators that performs the same
function as casting a pointer to void*
in order to get the address of the element.
[2018-02-20, Priority set to 3 after mailing list discussion]
Proposed resolution: