C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Conditional copy ctor for std::map / std::unordered_map

From: Arthur O'Dwyer <arthur.j.odwyer_at_[hidden]>
Date: Tue, 28 Feb 2023 09:25:00 -0500
On Mon, Feb 27, 2023 at 10:37 PM Mingxin Wang via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> When instantiating `std::map` or `std::unordered_map`, the value type
> could be non-copyable (but movable). However, both class templates have
> copy ctors and assignments. I do not see any wording suggesting they shall
> be deleted like `std::optional` does ([optional.ctor] Remarks: This
> constructor is defined as deleted unless is_copy_constructible_v<T> is
> true. If is_trivially_copy_constructible_v<T> is true, this constructor is
> trivial.) Shall we refine the wording here?
>

https://quuxplusone.github.io/blog/2020/02/05/vector-is-copyable-except-when-its-not/

HTH,
Arthur

Received on 2023-02-28 14:25:13