| ||||
| ||||
![]() Title:Domain modeling using template metaprogramming Conference:ECAI-2025 Tags:code generation, compile-time computation and type safety Abstract: Template metaprogramming (TMP) offers a powerful computation and code generation mechanism. This paper explores its application to domain modeling, a critical aspect of software development. By leveraging TMP, we propose a novel approach to constructing intricate domain models using known techniques. To begin, we compare the built-in memory Abstract Syntax Tree (AST) at compile time with the memory footprint version of the same algorithm (BTree) at runtime. This analysis is carried out using the visualization tool from Microsoft Visual C++ alongside a dedicated memory tracking library (MemTracker). Following this initial optimization that saves 40 bytes of allocated memory, we implement further runtime optimizations that concentrate on trivalent logic through the use of specialized templates and recursion via variadic templates. Our methodology relies on standard C++ techniques, such as recursive templates, Pair structures, and metatypes, for modeling simple data structures like binary trees. It encapsulates domain concepts, relationships, and invariants within template metaprograms, enhancing type safety, performance, and code clarity. The approach relies heavily on popular and personal GitHub repositories, showcasing how TMP can streamline domain modeling while improving code quality and maintainability. Domain modeling using template metaprogramming ![]() Domain modeling using template metaprogramming | ||||
Copyright © 2002 – 2025 EasyChair |