I was wondering why the uninitialized storage functions like https://en.cppreference.com/w/cpp/memory/uninitialized_copy and https://en.cppreference.com/w/cpp/memory/uninitialized_move are not constexpr in C++20?
Going off of the "possible implementation" provided, wouldn't it only take converting
template<class InputIt, class ForwardIt>
ForwardIt uninitialized_copy(InputIt first, InputIt last, ForwardIt d_first)
{
typedef typename std::iterator_traits<ForwardIt>::value_type Value;
ForwardIt current = d_first;
try {
for (; first != last; ++first, (void) ++current) {
::new (static_cast<void*>(std::addressof(*current))) Value(*first);
}
return current;
} catch (...) {
for (; d_first != current; ++d_first) {
d_first->~Value();
}
throw;
}
}
to
template<class InputIt, class ForwardIt>
constexpr ForwardIt uninitialized_copy(InputIt first, InputIt last, ForwardIt d_first)
{
typedef typename std::iterator_traits<ForwardIt>::value_type Value;
ForwardIt current = d_first;
try {
for (; first != last; ++first, (void) ++current) {
std::construct_at(current, *first); // <---- THIS
}
return current;
} catch (...) {
for (; d_first != current; ++d_first) {
d_first->~Value();
}
throw;
}
}
for the uninitialized_copy case? Or am I missing something?