Created on 2018-02-12.00:00:00 last changed 81 months ago
[ 2018-02-20, Priority set to 3 after mailing list 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 that static_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.History | |||
---|---|---|---|
Date | User | Action | Args |
2018-03-03 15:21:00 | admin | set | messages: + msg9696 |
2018-02-12 00:00:00 | admin | create |