C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Delete...why not a parameter by reference?!

From: Simon Schröder <dr.simon.schroeder_at_[hidden]>
Date: Sun, 24 Aug 2025 18:59:27 +0200
> On Aug 24, 2025, at 6:21 PM, organicoman via Std-Proposals <std-proposals_at_[hidden]> wrote:
>
>
> But library implemented and low level will definitely use raw pointers....just show me how many std::vector implementation uses smart pointers for its internal data pointer.

No std::vector uses smart pointers because they were implemented before smart pointers were a thing. And changing that would break the ABI (programs wouldn’t link with existing libraries). Also, this is a completely different discussion: classes can ensure invariants on their member variables and we have RAII. As long as we don’t leak raw pointers from a member variable we are reasonably safe.

And again: Even for low-level code you should start using unique_ptr. There maybe special cases were they don’t work, but in 90% of the cases there is no reason to not use them.
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

Received on 2025-08-24 16:59:40