1
vote
Vote UpVote

As Delphi generics are not supported for free functions, wrap them in a record container.

The Wiert Corner – Of the things not possible with generics in Delphi, I already wrote about Impossible: Property using Generics in Delphi. Now it’s time to write about simulating a free function with generics as this is impossible: function CreateManaged<T>(const value: T): IManaged<T>; Usually I create a static record method for these, as records do not have VMT overhead, less RTTI overhead and I’ve been used to see records as helpers for other types long before helpers initially were introduced in Delphi 8 to extend classes.. Spring4D has an excellent example of such a record ...
Favorite? Off-Topic? jpluimers @ 2018-01-31 06:05

Statistics

Visits: 242
Votes: 1
Favorites: 0
Off-Topic: 0

Visits by Source

User Actions

Users who voted for this posting

Alister Christie
Subscribe:
Contact us to advertise on DelphiFeeds.com

Community Links

Torry Firebird News

Sponsor

 
Please login or register to use this functionality.
(click on this box to dismiss)