Daily bit(e) of C++ | std::make_unique_for_overwrite, std::make_shared_for_overwrite and std::allocate_shared_for_overwrite
Daily bit(e) of C++ #440, The C++20 set of smart pointer construction functions: std::make_unique_for_overwrite, std::make_shared_for_overwrite and std::allocate_shared_for_overwrite.
The C++20 standard introduced a new set of smart pointer construction functions: std::make_unique_for_overwrite, std::make_shared_for_overwrite and std::allocate_shared_for_overwrite.
These variants default-initialize the allocated memory, unlike the value-initialization of previous variants.
This avoids duplicate initialization of POD types when the memory is immediately overwritten.