× General discussions, feature requests for CodeTyphon Project and discussions that don't fit in any of the other specific CodeTyphon forum categories.

Question smart pointer

  • sakata
  • Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
More
4 years 4 months ago #9628 by sakata
smart pointer was created by sakata
Hi,

I want to smart pointer.
I want to convert the code of Delphi to FreePascal
type
  Auto<T: class> = reference to function: T;

  TAuto<T: class> = class(TInterfacedObject, Auto<T>)
  private
    FValue: T;
  public
    constructor Create(AValue: T);
    destructor Destroy; override;
    function Invoke: T;
  end;

  Auto = class
  public
    class function Wrap<T: class>(AValue: T): Auto<T>; static;
  end;
>> Compile Error: interface type expected, but got "TAuto$1.<procedure variable type of function:T of object;Register>"

Please Log in or Create an account to join the conversation.

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Away
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
More
4 years 4 months ago - 4 years 4 months ago #9630 by Sternas Stefanos
Replied by Sternas Stefanos on topic smart pointer
Please Sir
read this

PS: For your info,
many PilotLogic programmers, don't like Delphi Pascal with generics.

PilotLogic Architect and Core Programmer
Last edit: 4 years 4 months ago by Sternas Stefanos.

Please Log in or Create an account to join the conversation.