1
General / Re: Generics - correct syntax
« Last post by Blaazen on Today at 01:57:40 am »It's this (line 58 of https://github.com/james-mcjohnson/VulkanLibraryForFreePascal/blob/master/vulkan_vk_xml_to_pas.pas)
EDIT: @jamie
Your code also needs
with FPC 3.3.1
- { TCreateChildList }
- generic TCreateChildList<T> = class(specialize TFPGObjectList<T>)
- function CreateChild(Level: Integer = -1): T;
- function GetListing(IncludeLastDelimiter: Boolean; aDelimiter: String; NoCRLF: Boolean = False): String;
- function FindIdentifier(aIdentifier: String): T;
- function FindIdentifierIndex(aIdentifier: String): Integer;
- procedure MoveIdentifierBefore(aIdentifier1, aIdentifier2: String);
- end;
- TComment = class;
- TExtension = class;
- { TListObj }
- TListObj = class
- private
- FLevel: Integer;
- public
- Identifier: String;
- CommentInternal: String;
- AcceptLateComment: Boolean;
- PreComment, PostComment: TComment;
- function GetPreComment: String;
- function GetPostComment(curlen: Integer): String;
- function SpaceOutPostComment(curlen: Integer; CommentText: String): String;
- function GetListing(Delimiter: String; NoCRLF: Boolean = False): String;
- function GetInfo(Delimiter: String): String; virtual;
- function GetExtraInfo: String; virtual;
- end;
- TPointerDepth = class(TListObj)
- NeededPointerDepth: Integer;
- end;
- TPointerDepthList = specialize TCreateChildList<TPointerDepth>;
EDIT: @jamie
Your code also needs
- generic TCreateChildList<T: class> = class(specialize TFPGObjectList<T>);