Re: [fpc-devel] 2 Ideas for generic TDictionary and other hash containers

2025-03-27 Thread Marco van de Voort via fpc-devel
Op 27-3-2025 om 12:28 schreef Martin Frb via fpc-devel: which returns True, if Akey was found and therefore APtr points to existing Data, while otherwise APtr points to the empty slot, where the data can be copied to. Without a key, you can't find the bucket or whatever where to allocate,

Re: [fpc-devel] 2 Ideas for generic TDictionary and other hash containers

2025-03-27 Thread Stefan Glienke via fpc-devel
For your second feature request it just needs a method added to THashSet that retrieves the stored item based on the passed key. > On 27/03/2025 12:28 CET Martin Frb via fpc-devel > wrote: > > > There are 2 features, I am missing. > > And I can't see a way to add them via subclassing, as th

Re: [fpc-devel] 2 Ideas for generic TDictionary and other hash containers

2025-03-27 Thread Stefan Glienke via fpc-devel
It does not violate the contract imho. In a TDictionary it would return a pointer to V which is valid because it either retrieved an existing entry or added a new one with default(v). I implemented this a while ago in Spring4D roughly following the API that was introduced in .NET some time ago.

Re: [fpc-devel] 2 Ideas for generic TDictionary and other hash containers

2025-03-27 Thread Martin Frb via fpc-devel
On 27/03/2025 12:45, Martin Frb via fpc-devel wrote: On 27/03/2025 12:33, Marco van de Voort via fpc-devel wrote: Op 27-3-2025 om 12:28 schreef Martin Frb via fpc-devel: which returns True, if Akey was found and therefore APtr points to existing Data, while otherwise APtr points to the empty

Re: [fpc-devel] 2 Ideas for generic TDictionary and other hash containers

2025-03-27 Thread Martin Frb via fpc-devel
On 27/03/2025 12:33, Marco van de Voort via fpc-devel wrote: Op 27-3-2025 om 12:28 schreef Martin Frb via fpc-devel: which returns True, if Akey was found and therefore APtr points to existing Data, while otherwise APtr points to the empty slot, where the data can be copied to. Without a k