We'll need some collection classes and algorithms which will be used everywhere in engine.
Requirements:
- implementation of at least List, Map (dictionary) and sorting
- work with different types, including primitive ones (non classes)
- high performance
- type safe
- without code duplication
Class/interface based approaches are not comply with requirement #2 and #3.
Pointer-based implementations conflicts with requirement #4.
I know two remaining solutions:
1. Generics.
+ intended to solve this problem exactly
- not supported by Delphi 7 and FPC 2.6.2
2. include-based template approach
+ max performance and flexibility
+ support of D7 and FPC 2.6.2
- only one instantiation of each template per unit
- hard to read and support template code (does not apply to code using the templates)
I've implementation of the second approach:
https://github.com/casteng/base/tree/dev/template
You can see what it looks like.
We can drop support of D7 and FPC 2.6.2 and go with generics.
What do you think guys?
Bookmarks