Skip to content

Abstract type wrapping to a macro? #17

@molpopgen

Description

@molpopgen

The current TableCollection relies on a heap-allocated tsk_table_collection_t stored in a Box. Thus, we have to do all this "maybe uninitialized" stuff. It would be an improvement to take a cue from rust-GSL and offload the necessary boiler plate to a macro:

  1. Pass in the type name, "tskit init" function name, and "tskit free" function name.
  2. Heap allocate the type.
  3. Init.
  4. Implement Drop using the free function.
  5. Provide boiler plate for owning and non-owning wrappers, etc..

The nice thing is that this can all be done w/o breaking user-facing API and we can re-use the macro for other types.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions