libebml_ng
The CRTP Design Pattern

A comprehensive guide to using the ebmlTypeCRTP and ebmlElementCRTP mixin templates.

This page provides detailed usage guidelines for implementing your own EBML element types and instances using the library's Curiously Recurring Template Pattern (CRTP) mixins.

The Purpose of the CRTP Mixins

The ebmlTypeCRTP and ebmlElementCRTP templates work together to provide compile-time type safety and automatic pointer conversions. By inheriting from these templates, your custom EBML types gain all the necessary decoding, encoding, and instance creation functionality without the need for manual casting.

Usage Guidelines

To create a paired EBML element type and instance:

Required Implementations

To integrate proper decoding and cloning, the following must be implemented: