|
Generics with Delphi 2009 Win32
With, as a bonus, anonymous routines and routine references
Date de publication : November 13th, 2008
Par
Sébastien Doeraene (sjrd.developpez.com)
We have been waiting for them for a while! Now they are here: generics in Delphi Win32. Those little awesome things are
coming with Delphi 2009. This tutorial will help you understand and use them, and design your own generic classes.
This is a translation of a tutorial initially written in French:
![]()
Juan Badell has also translated this tutorial into Spanish:
Los genéricos en Delphi
2009
(HTTP mirror)
Aleksey Timohin has
also made
a translation
into Russian. This translation may be read in PDF form, which was built by Andrew Tishkin (HTTP mirror).
Introduction I. Introduction I-A. Prerequisite I-B. What are generics? Daily usage II. Daily usage: the example of TList<T> II-A. A simple code to start with II-B. Assignments between generic classes II-C. Methods of TList<T> II-D. TList<T> and comparers II-D-1. Writing a comparer using TComparer<T> II-D-2. Writing a comparer using a simple comparison function Design of a generic class III. Design of a generic class III-A. Class declaration III-B. Implementing a method III-C. The pseudo-routine Default III-D. Routine references with tree walks III-D-1. Other methods using anonymous routines? III-E. And the rest III-F. How to use TTreeNode<T> ? Design of a generic record IV. Design of a generic record More with generics: constraints, several parameters V. Contraints on generic types V-A. What are the available constraints? V-B. But what is the purpose of it? V-C. A variant with constructor VI. Parameterizing with more than on type VII. Other generic types Generic methods VIII. Generic methods VIII-A. A generic Min function VIII-B. Overloading and constraints VIII-C. Some extras for TList<T> RTTI and generics IX. RTTI and generics IX-A. Changes to the pseudo-routine TypeInfo IX-A-1. A more general TypeInfo function IX-B. Do generic types have RTTI? Conclusion X. Conclusion XI. Download the sources XII. Acknowlegments Warning: include(): http:// wrapper is disabled in the server configuration by allow_url_include=0 in /home/developpez/www/developpez-com/upload/sjrd/delphi/tutoriel/generics/index.php on line 41 Warning: include(http://sjrd.developpez.com/references.inc): failed to open stream: no suitable wrapper could be found in /home/developpez/www/developpez-com/upload/sjrd/delphi/tutoriel/generics/index.php on line 41 Warning: include(): Failed opening 'http://sjrd.developpez.com/references.inc' for inclusion (include_path='.:/opt/php56/lib/php') in /home/developpez/www/developpez-com/upload/sjrd/delphi/tutoriel/generics/index.php on line 41 |
Copyright © 2008-2009 Sébastien Doeraene. Aucune reproduction, même partielle, ne peut être faite de ce site ni de l'ensemble de son contenu : textes, documents, images, etc. sans l'autorisation expresse de l'auteur. Sinon vous encourez selon la loi jusqu'à trois ans de prison et jusqu'à 300 000 € de dommages et intérêts.