From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.31.237.131 with SMTP id l125mr7005396vkh.54.1504361020732; Sat, 02 Sep 2017 07:03:40 -0700 (PDT) X-Received: by 10.36.67.12 with SMTP id s12mr45185itb.3.1504361020583; Sat, 02 Sep 2017 07:03:40 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!paganini.bofh.team!weretis.net!feeder6.news.weretis.net!feeder.usenetexpress.com!feeder-in1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!v20no1084108qtg.0!news-out.google.com!c139ni628itb.0!nntp.google.com!127no133786itw.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sat, 2 Sep 2017 07:03:40 -0700 (PDT) In-Reply-To: <73399847-b482-4442-a02f-1bf9c67b467b@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=173.71.208.22; posting-account=QF6XPQoAAABce2NyPxxDAaKdAkN6RgAf NNTP-Posting-Host: 173.71.208.22 References: <73399847-b482-4442-a02f-1bf9c67b467b@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <06eded64-5ae6-4f2f-b0e9-0e13a6d89b0d@googlegroups.com> Subject: Re: Interest in standard smart pointers for Ada 2020 From: Jere Injection-Date: Sat, 02 Sep 2017 14:03:40 +0000 Content-Type: text/plain; charset="UTF-8" Xref: news.eternal-september.org comp.lang.ada:47888 Date: 2017-09-02T07:03:40-07:00 List-Id: On Thursday, August 31, 2017 at 11:17:12 AM UTC-4, Lucretia wrote: > On Thursday, 31 August 2017 13:12:20 UTC+1, Alejandro R. Mosteo wrote: > > I wonder if there would be interest in standardizing some usual smart > > pointers for the next revision. I will try to state the problems. I hope > > you'll point any misunderstandings on my part. > > Yes, I've had to write these in the past too. Royal pain to keep doing. > > > If we look at the cousin C++, the standard pointers there are: > > Cousin? > > > > unique_ptr [1] > > > > > Allows exactly one owner of the underlying pointer. Use as the default choice for POCO unless you know for certain that you require a shared_ptr. Can be moved to a new owner, but not copied or shared. > > I just had to look up POCO, seems to be Plain old CLR Object, don't think that's what you meant. > > I would add auto_ptr too, I've implemented one before, although I think Block_Pointer would be a better Ada name for it. Should be limited, initialised with extended return and frees the contents at the end of the block in which it was instantiated. Out of curiosity, what feature of auto_ptr are you looking for that isn't provided by unique_ptr. It was designed to be a more efficient replacement of auto_ptr, and it has all of the auto_ptr semantics available to my knowledge.