Click here to Skip to main content
15,881,172 members
Articles / General Programming / Memory Management

Using C++ Templates to Implement Dynamic Memory Objects with Custom Allocator

Rate me:
Please Sign up or sign in to vote.
5.00/5 (8 votes)
22 Jan 2023MIT12 min read 13.7K   115   10  
How to use C++ templates for implementing dynamic memory objects with custom allocator
In this article, I describe one way to implement objects that dynamically manage their own memory by deriving from template classes that represent the behavioral contract of a block of memory, using an allocator class as template arguments.

Views

Daily Counts

Downloads

Weekly Counts

License

This article, along with any associated source code and files, is licensed under The MIT License


Written By
Software Developer
Belgium Belgium
I am a former professional software developer (now a system admin) with an interest in everything that is about making hardware work. In the course of my work, I have programmed device drivers and services on Windows and linux.

I have written firmware for embedded devices in C and assembly language, and have designed and implemented real-time applications for testing of satellite payload equipment.

Generally, finding out how to interface hardware with software is my hobby and job.

Comments and Discussions