diff --git a/ebml/EbmlMaster.h b/ebml/EbmlMaster.h index edf2803b..417ae14c 100644 --- a/ebml/EbmlMaster.h +++ b/ebml/EbmlMaster.h @@ -152,6 +152,11 @@ class EBML_DLL_API EbmlMaster : public EbmlElement { bool ProcessMandatory(); }; +static inline constexpr const EbmlSemanticContextMaster & tEBML_CONTEXT(const EbmlMaster * e) +{ + return e->ContextMaster(); +} + ///< \todo add a restriction to only elements legal in the context template Type & GetChild(EbmlMaster & Master) diff --git a/test/test_macros.cxx b/test/test_macros.cxx index dafb3014..5348c8db 100644 --- a/test/test_macros.cxx +++ b/test/test_macros.cxx @@ -147,6 +147,10 @@ int main(void) [[maybe_unused]] const EbmlSemanticContext &ctx = EBML_CLASS_CONTEXT(EbmlHead); [[maybe_unused]] const EbmlSemanticContextMaster &ctxMaster = EBML_CLASS_CONTEXT(EbmlHead); + EbmlHead TestHead; + [[maybe_unused]] const EbmlSemanticContextMaster & MasterContext = EBML_CONTEXT(&TestHead); + [[maybe_unused]] const EbmlSemanticContext & BasicContext = EBML_CONTEXT(&TestHead); + [[maybe_unused]] const auto & AutoContext = EBML_CONTEXT(&TestHead); return 0; }