Forum > General

Generics.Collections

<< < (2/3) > >>

Thaddy:
TryAdd IS available through TOpenAddressing, which is an abstract ancestor  of TDictionary.
See line 265 in generics.dictionariesh.inc
The implementation is on line 610 of generics.dictionaries.inc
Note TryAdd is public, so it is not hidden.

So I can't explain Error: identifier idents no member "tryAdd"

PascalDragon:

--- Quote from: Thaddy on January 11, 2022, 10:04:53 am ---TryAdd IS available through TOpenAddressing, which is an abstractancestor  of TDictionary.
See line 265 in generics.dictionariesh.inc
The implementation is on line 610 of generics.dictionaries.inc

--- End quote ---

Indeed, it should be available since 3.2.2, considering I committed that myself. :-[

@Vaytl: what version of FPC/Lazarus are you using?

Vaytl:

--- Quote from: PascalDragon on January 11, 2022, 10:14:22 am ---@Vaytl: what version of FPC/Lazarus are you using?

--- End quote ---
Lazarus IDE v2.2.0RC1 r65419 X64
FPC: 3.2.2

bytebites:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---program Project1;{$mode delphi}uses Generics.Collections;var d:TDictionary<byte,byte>;    i:byte;begin  d:=TDictionary<byte,byte>.create;  d.tryadd(3,4);  if d.trygetvalue(3,i) then writeln(i);  d.free;end.         This compiles with FPC 3.2.2

Thaddy:

--- Quote from: Vaytl on January 11, 2022, 05:20:03 pm ---Lazarus IDE v2.2.0RC1 r65419 X64
FPC: 3.2.2

--- End quote ---
Think again, that does not make sence.
Note that you should focus on fpc. Lazarus has nothing to do with this.
TryAdd simply works, as demonstrated above.
If the example from Bytebites fails you have an old version and not a release version of 3.2.2..

BTW @Sarah: You have a sneaky way to implement features....Respect. :o ::) :-X

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version