From: DrPi <314@drpi.fr>
Subject: Re: Map iteration and modification
Date: Fri, 29 Dec 2023 14:53:53 +0100 [thread overview]
Message-ID: <ummj1i$e64$1@rasp.pasdenom.info> (raw)
In-Reply-To: <umld63$n81g$1@dont-email.me>
Le 29/12/2023 à 04:08, Randy Brukardt a écrit :
> "DrPi" <314@drpi.fr> wrote in message
> news:umjuvc$9sp$2@rasp.pasdenom.info...
>> Le 28/12/2023 à 14:53, DrPi a écrit :
>>> Iterate the Map and temporarily store the key nodes to be deleted then
>>> delete the nodes from the key list ?
>>
>> Not clear. Rephrasing it.
>> Using 2 steps by iterating the Map and temporarily store the keys of nodes
>> to be deleted then delete the Map nodes using the key list ?
>
> If the keys are messy to save (as say with type String), it might be easier
> to save the cursor(s) of the nodes to delete. You would probably want to use
> a cursor iterator (that is, "in") to get the cursors. Code would be
> something like (declarations of the Map and List not shown, nor is the
> function Need_to_Delete which is obviously application specific, Save_List
> is a list of cursors for My_Map, everything else is standard, not checked
> for syntax errors):
>
> Save_List.Empty; -- Clear list of saved cursors.
> -- Find the nodes of My_Map that we don't need.
> for C in My_Map.Iterate loop
> if Need_to_Delete (My_Map.Element(C)) then
> Save_List.Append (C);
> -- else no need to do anything.
> end if;
> end loop;
> -- Delete the cursors of the nodes we don't want anymore.
> for C of Save_List loop
> My_Map.Delete(C);
> end loop;
>
>
That's what I did but I saved the keys (String) instead of the cursors.
Does it make a difference ? Performance maybe ?
Nicolas
>
> Randy.
>
>
next prev parent reply other threads:[~2023-12-29 13:53 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-28 13:53 Map iteration and modification DrPi
2023-12-28 13:59 ` DrPi
2023-12-28 16:06 ` Dmitry A. Kazakov
2023-12-28 17:57 ` DrPi
2023-12-29 3:20 ` Randy Brukardt
2023-12-29 9:51 ` Dmitry A. Kazakov
2023-12-29 15:03 ` G.B.
2023-12-29 16:52 ` Dmitry A. Kazakov
2024-01-01 19:27 ` G.B.
2024-01-01 20:55 ` Dmitry A. Kazakov
2024-01-02 16:40 ` G.B.
2024-01-02 20:57 ` Dmitry A. Kazakov
2024-01-03 3:22 ` Randy Brukardt
2024-01-03 4:05 ` moi
2023-12-30 7:21 ` Randy Brukardt
2023-12-30 11:07 ` Dmitry A. Kazakov
2024-01-03 3:15 ` Randy Brukardt
2024-01-03 10:04 ` Dmitry A. Kazakov
2024-01-04 4:07 ` Randy Brukardt
2024-01-04 11:28 ` Dmitry A. Kazakov
2024-01-05 2:00 ` Randy Brukardt
2024-01-05 9:26 ` Simon Wright
2024-01-05 11:51 ` Dmitry A. Kazakov
2024-01-06 7:25 ` Randy Brukardt
2024-01-07 15:06 ` Jeffrey R.Carter
2024-01-09 4:46 ` Randy Brukardt
2024-01-09 5:56 ` when-clauses (was Re: Map iteration and modification) Lawrence D'Oliveiro
2024-01-09 9:43 ` Map iteration and modification Jeffrey R.Carter
2024-04-17 10:12 ` Cóilín Nioclás Pól Glostéir
2024-01-06 2:54 ` “Usability” (was Re: Map iteration and modification) Lawrence D'Oliveiro
2024-01-06 7:03 ` "Usability" " Randy Brukardt
2024-01-06 8:14 ` Niklas Holsti
2024-01-06 23:41 ` Lawrence D'Oliveiro
2024-01-07 1:21 ` J-P. Rosen
2024-01-09 15:19 ` Bill Findlay
2024-01-09 20:30 ` Lawrence D'Oliveiro
2023-12-29 3:08 ` Map iteration and modification Randy Brukardt
2023-12-29 13:53 ` DrPi [this message]
2023-12-30 6:29 ` Randy Brukardt
2023-12-31 13:56 ` DrPi
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox