comp.lang.ada
 help / color / mirror / Atom feed
From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: Move semantics
Date: Tue, 20 Sep 2022 17:46:24 +0300	[thread overview]
Message-ID: <jou220F67gpU1@mid.individual.net> (raw)
In-Reply-To: <0b04f763-fa89-4b34-ad52-eb9d57d80d8cn@googlegroups.com>

On 2022-09-20 14:44, AdaMagica wrote:
> Paul Rubin schrieb am Montag, 19. September 2022 um 20:50:50 UTC+2:
>> I think it refers to the C++ notion.
>> https://en.cppreference.com/w/cpp/utility/move
> 
> What I do not understand: Why should the move operation be less expensive than a copy?
> As I see it: First you have to do a copy, then delete the source.


The standard Ada containers have Move operations.

Containers are of course often implemented with indirection, where the 
container object contains accesses to the data held in the container, so 
a Move operation only has to copy the access values from the source to 
the target, and does not need to copy the data. The access values in the 
source are then nulled, making the source container empty. This is often 
less expensive than copying the data.

Eg. for Vectors, the Ada RM says "Move should not copy elements, and 
should minimize copying of internal data structures."

For the bounded Ada containers, which are not meant to use indirection, 
while there are Move operations the RM says that the implementation 
advice "to minimize copying" does not apply.


  reply	other threads:[~2022-09-20 14:46 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-25 10:01 yet another Ada web site? Maxim Reznik
2022-08-26 18:58 ` Paul Rubin
2022-08-27  9:12 ` Rene
2022-08-27  9:53   ` Nasser M. Abbasi
2022-08-28  7:21     ` Simon Wright
2022-08-28  7:50     ` Dmitry A. Kazakov
2022-08-28 10:26       ` Luke A. Guest
2022-09-16 15:25         ` Maxim Reznik
2022-09-16 17:07           ` Luke A. Guest
2022-09-16 17:34           ` Stephen Leake
2022-09-16 18:45             ` Jere
2022-09-17  9:45               ` Luke A. Guest
2022-09-16 18:49           ` Jere
2022-09-17 13:08           ` Move semantics (was: yet another Ada web site?) G.B.
2022-09-19 17:04             ` Move semantics Stephen Leake
2022-09-19 18:50               ` Paul Rubin
2022-09-20 11:44                 ` AdaMagica
2022-09-20 14:46                   ` Niklas Holsti [this message]
2022-09-20 19:39                   ` Paul Rubin
2022-09-24  6:54                 ` Stephen Leake
2022-09-18  8:47           ` yet another Ada web site? grosdan
2022-09-18 10:57             ` Dmitry A. Kazakov
2022-09-18 16:28             ` Luke A. Guest
2022-09-19 17:02             ` Stephen Leake
2022-09-19  6:39           ` Emmanuel Briot
2022-09-30 10:29   ` shtps
2022-09-30 12:29     ` Niklas Holsti
2022-10-09 16:13       ` Stephen Leake
2022-10-12  4:21         ` Paul Jarrett
2022-10-13  0:06           ` Stephen Leake
2022-10-13  6:58             ` Dmitry A. Kazakov
2022-10-14  8:41               ` Fabien Chouteau
2022-10-14 10:05                 ` Dmitry A. Kazakov
2022-10-14 11:19                   ` Stephen Leake
2022-10-14 13:05                     ` Dmitry A. Kazakov
2022-10-16  8:54                       ` G.B.
2022-10-16  9:20                         ` Dmitry A. Kazakov
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox