C++ Logo


Advanced search

Re: default_new?

From: Jason McKesson <jmckesson_at_[hidden]>
Date: Wed, 23 Nov 2022 12:00:00 -0500
On Wed, Nov 23, 2022 at 11:26 AM Antony Peacock via Std-Discussion
<std-discussion_at_[hidden]> wrote:
> But we do have proposals which include std::default_copy (p0201r6 & p1950r2) which is as close of an analogous use case as I am aware of. Note we use separate types for allocator support in this case.

Those are not proposals for `default_copy`; they are proposals that
*include* `default_copy` as part of what they're doing. The copying
behavior of those types is something that you specify as a parameter.
But the initial `indirect_value` is always given a pointer to an
existing object which is adopted, much like `unique_ptr`. You have the
choice of `make/allocate_indirect_value`, just like `unique_ptr`.

So what purpose would your hypothetical `default_new` suggestion serve?

Received on 2022-11-23 17:01:58