Forum > General

Missing Assign method in RTL-Generics Classes

(1/2) > >>

simone:
I'm converting an old code base that uses FGL intensively, to replace above library with RTL-Generics. Conversion is not presenting any particular difficulties. However, there is a detail that I noticed and wanted to share.

I've seen that while TFPGObjectList<T> in FGL has the assign method to copy all elements of one list to another, its RTL-generics counterpart TObjectList<T> does not have such a method. It is not a problem to solve this. But I'm curious to know if it is an oversight or a choice dictated by specific reasons.

Thanks in advance.

marcov:
Seems that Embarcadero chose a different approach for those:

https://stackoverflow.com/questions/9787296/is-there-an-easy-way-to-copy-the-tdictionary-content-into-another.

I assume the ownership properties of objectlist can also complicate this.

Thaddy:
TFpgObjectList is NOT part of RTL-Generics but part of FGL, that is correct.
The mechanism that Rtl-generics uses is either through its constructors, TEnumerable<T> as common ancestor for collections.
Or you can use its array transfer utility functions.
So assignment is easily possible, it just uses different symantics.

simone:
I think you don't read before you write (again).

(removed after Thaddy's rectification)

Thaddy:
No. If you payed attention the issue was solved. Added explanation of TEnumerable<T>, though.

Navigation

[0] Message Index

[#] Next page

Go to full version