C++ Logo

std-proposals

Advanced search

Re: [std-proposals] copy constructor of std::vector

From: Thiago Macieira <thiago_at_[hidden]>
Date: Tue, 13 Jun 2023 10:49:15 -0700
On Tuesday, 13 June 2023 10:31:36 PDT Federico Kircheis via Std-Proposals
wrote:
> Is there no situation where we can talk only about types where we know
> if those are not copyable? (I fear I know the answer)
>
> For example std::vector<std::unique_ptr<T>>, no matter what T is.

  template <typename _Tp, typename _Dp = default_delete<_Tp>>
    class unique_ptr;

You can't write that for a standard library type, but libraries can for their
own types. Are you going to add a rule to the standard that only applies to
std::unique_ptr? Might as well partially specialise std::vector for
std::unique_ptr<T> and the last time we did that we ended up with
std::vector<bool>.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel DCAI Cloud Engineering

Received on 2023-06-13 17:49:17