The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

    • RT @nadineswagerman: Iemand mailde me dat een 13-jarig meisje mijn novelle had uitgekozen om te lezen/bespreken op school. Het boek bevat 9… 2 hours ago
    • RT @jilles_com: Afgelopen 10 dagen hebben we door NL gereisd, elke dag een nieuw hotel en op heel veel locaties gegeten. In 60% van de geva… 2 hours ago
    • RT @FTM_nl: Sywert van Lienden plaatste bewust een serie tweets om het ministerie onder druk te zetten om de omstreden mondkapjesdeal met h… 2 hours ago
    • RT @ArmsControlWonk: China just used a rocket to put a space plane in orbit and the space plane glided back to earth. Orbital bombardment i… 2 hours ago
    • RT @shossontwits: O jee. Nu dit weer. 2 hours ago
  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 2,482 other followers

Use operator overloading for classes with non-ARC compiler · GitHub

Posted by jpluimers on 2017/11/23

[WayBackUse operator overloading for classes with non-ARC compiler · GitHub

The trick: do not use class operator but use class function &&op_ with the special operator name in the table referenced below. Just follow the bulleted example links to get an idea.

Bonus: it works on class helper constructs as well.

Officially this unsupported and with the non-ARC compiler you will have a risk of memory leaks.

But it’s so much fun as these links prove:

The usual operator gotchas apply here as well: Delphi operator overloading: table of operators, names, and some notes on usage and ‘glitches’.

The operators you could try: [WayBackOperator Overloading (Delphi) – RAD Studio

Oh, this thread needs some change now: [WayBackList of Delphi language features and version in which they were introduced/deprecated – Stack Overflow


One Response to “Use operator overloading for classes with non-ARC compiler · GitHub”

  1. rvelthuis said

    It makes sense for operators that do not return an instance of the same class, but e.g. a Boolean, e.g. operators like in, comparison operators, etc. They do not bear the risk of memory leaks.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: