C++ Logo

std-proposals

Advanced search

initializer list overload for std::construct_at

From: Desmond Gold Bongcawel <desmondbongcawel922_at_[hidden]>
Date: Sat, 1 Jan 2022 17:28:17 +0800
I would like to share one of my ideas for std::construct_at improvement
that will take std::initializer_list as the first argument.

template <typename T, typename... Args>
constexpr T* construct_at(T* ptr, Args&&... args);

template <typename T, typename U, typename... Args>
constexpr T* construct_at(T* ptr, std::initializer_list<U> il, Args&&...
args);

the goal of this new overload enables usage of the type that takes
initializer-list as the first argument. This will create consistency with
some of the vocabulary type's in-place constructions.

ex:
std::construct_at(some_ptr, {1, 2, 3, 4});

Received on 2022-01-01 03:28:30