Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Pointer auf generischen Record (https://www.delphipraxis.net/192487-pointer-auf-generischen-record.html)

himitsu 22. Apr 2017 18:08

Delphi-Version: XE3

Pointer auf generischen Record
 
Nichtgenerisch kein Problem,
Delphi-Quellcode:
type
  PMyRecord = ^TMyRecord;
  TMyRecord = record
    ...
  end;
Delphi-Quellcode:
type
  TMyRecord = record
  public type
    PMyRecord = ^TMyRecord;
  public
    ...
  end;
aber generisch will der Compiler nicht.
Delphi-Quellcode:
type
  PMyRecord<T> = ^TMyRecord<T>;
  TMyRecord<T> = record
    ...
  end;
Delphi-Quellcode:
type
  TMyRecord<T> = record
  public type
    PMyRecord = ^TMyRecord<T>;
  public
    ...
  end;
Leider brauch ich einen passenden typisierten Pointer. :cry:

hanvas 22. Apr 2017 19:27

AW: Pointer auf generischen Record
 
Hilft Dir das weiter ?
Delphi-Quellcode:
 
type
  TStatic<T> = class
  public
    type
      TRec = record
        a : T;
      end;
      PRec = ^TRec;
  public
    class function RecPTR : PRec; static;
  end;


Alle Zeitangaben in WEZ +1. Es ist jetzt 09:57 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz