Skip to content

WIP: Added support for direct generics

Jakub Kaszycki requested to merge (removed):direct-generics into master

Direct generics are a rare phenomenon, the only notable example in GLib is GArray. Direct generics are handled using macros/sizeof and passed around by pointers (not in pointers), so they need not fit in a pointer. Thus, values like double, int64 or even funny structure types can be stored in GArray (unlike GPtrArray or GHashTable).

This commit implements a complete support of direct generics. Also, the GLib VAPI is adjusted for direct generics.

Direct generics are triggered by a new parameter to CCode. They are only supposed to be used in VAPI files, using them in normal source files is undefined. If your type is something else than a GArray, reconsider the matter twice before enabling direct generics.

Post scriptum: this feature was inspired by my need for a GLib.Array<int64>.

Edited by Rico Tzschichholz

Merge request reports