As Free Pascal 2.6.4 distribution does not include generic tree implementation (there are some limitation of compiler), I use my own named FGLExt for different purposes.
Here are 2 files in repository:
- fglext.pas - implements TFPGTree, TFPGTreeNode and TFPGStack classes
- fglexttest.pas - some unit tests for it and use cases
As I know, Free Pascal 3.x will be more generic-friendly so the more usable implementation of TFPGTreeNode may be done.