Class TGenericStructList
Unit
CastleGenericLists
Declaration
type generic TGenericStructList<T> = class(TFPSList)
Description
Generic list of types that are compared by CompareByte.
This is equivalent to TFPGList, except it doesn't override IndexOf, so your type doesn't need to have a "=" operator built-in inside FPC. When calling IndexOf or Remove, it will simply compare values using CompareByte, this is what TFPSList.IndexOf uses. This way it works to create lists of records, vectors (constant size arrays), old-style TP objects, and also is suitable to create a list of methods (since for methods, the "=" is broken, for Delphi compatibility, see http://bugs.freepascal.org/view.php?id=9228).
We also add some trivial helper methods like Add and L.
Hierarchy
- TFPSList
- TGenericStructList
Overview
Internal Types
Methods
Properties
 |
property Items[Index:Integer]: T read Get write Put; |
 |
property List: PTypeList read GetList; |
Description
Internal Types
 |
TCompareFunc = function(const Item1, Item2: T): Integer; |
|
Methods
 |
constructor Create; |
|
 |
function Add(const Item: T): Integer; |
|
 |
function Extract(const Item: T): T; |
|
 |
function First: T; |
|
 |
function IndexOf(const Item: T): Integer; |
|
 |
procedure Insert(Index: Integer; const Item: T); |
|
 |
function Last: T; |
|
 |
function Remove(const Item: T): Integer; |
|
 |
function L: PT; |
Pointer to items. Exactly like List, but this points to a single item, which means you can access particular item by L[I] instead of Listˆ[I] in FPC objfpc mode.
This is just trivial shortcut, but we use direct access a lot for structures. Reasons: using Items[] default property means copying the structures, which is
very dangerous (you can trivially easy modify a temporary result)
slow (important for us, since these are used for vector arrays that are crucial for renderer and various processing).
|
 |
function Add: PT; |
Increase Count and return pointer to new item. Comfortable and efficient way to add a new item that you want to immediately initialize.
|
Properties
 |
property Items[Index:Integer]: T read Get write Put; |
|
 |
property List: PTypeList read GetList; |
|
Generated by PasDoc 0.13.0 on 2013-08-17 21:27:12
|