All Questions
Tagged with memory-management template
13 questions
0
votes
1
answer
559
views
Vector Implementation C++ using RAII
I have attempted to implement a similar version of the STL Vector; several functions are missing but I'd like a few words of advice on whether I am indeed on the right track or whether I should change ...
3
votes
1
answer
975
views
Implementation of static_vector using an array of std::aligned_storage, with std::launder and forwarding
I'm trying to expand on the implementation of static_vector on the std::aligned_storage reference page, but would like to split it into two parts. First, an ...
8
votes
1
answer
123
views
Tracker for object construction, copy, and movement
I made an object tracker for debugging and testing purposes called ccm_counter (construction, copy, move counter). It counts constructor, copy and move calls. It ...
2
votes
1
answer
1k
views
C++ - Trie Implementation
I am trying to learn trie and this is my first implementation. I started off with the idea of being able to handle different data types for key and value; however, I found the data structure a bit ...
8
votes
2
answers
682
views
Custom fixed-space block memory allocator
This is a fixed-size memory allocator.
The core memory block is an unsigned char pointer which gets allocated on initialization. Other than that, it has pretty basic allocation and block safety ...
2
votes
1
answer
2k
views
Fixed-size C++ object pool, contiguous storage, O(1) random access, alloc and free. One header-only
I have implemented a rather simple object pool for the sake of entities in my game world, and it works quite well.
Advantages:
Elements stay in contiguous memory - can be iterated just like in an ...
2
votes
1
answer
517
views
C++ Policy-based object pool
Description
This is an improved implementation for a previous post
My goal was to implement a decent object pool using templates and policy based design. The object pool behaviour can be customized ...
6
votes
2
answers
5k
views
Fixed size Memory Pool Implementation
Here is an attempt at implementing a fixed size Memory Pool1:
pool.h
...
1
vote
1
answer
690
views
Template binary heap with lambda function comparator C++
This heap will be used for A* search pathfinding in my 2D isometric game engine. It uses lambda functions (instead of std::less or ...
10
votes
2
answers
3k
views
C++ custom memory allocator
I'm working on a C++ custom memory allocator, that would be kind of a replacement for the C flexible array syntax, you know, the stuff like that:
...
11
votes
1
answer
382
views
Wrapping types with alignment requirements
Visual Studio 2013 still doesn't support the alignas keyword in C++11. This causes some problems with alignment of types in various situations. Thankfully the ...
8
votes
2
answers
19k
views
STL Stack Implementation
I implemented std::stack from the STL for deeper understanding of the language and memory since I still am only a beginner. I implemented the stack using a singly ...
8
votes
1
answer
301
views
Associative container that produces a unique, instance specific handle for each inserted object
It is not always possible to simplify program design by strictly managing the lifetimes of objects. If two objects have unpredictable lifetimes, but one of them needs to refer to the other, a simple ...