Forum > General

Missing Assign method in RTL-Generics Classes

(1/2) > >>

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.

Seems that Embarcadero chose a different approach for those:

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

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.

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

(removed after Thaddy's rectification)

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


[0] Message Index

[#] Next page

Go to full version