Skip to main content

All Questions

Tagged with
8 votes
1 answer
833 views

A fixed-size dynamic array

Background I implemented the historic std::dynarray according to the specification under the name dynamic_array in C++17. ...
L. F.'s user avatar
  • 9,570
31 votes
1 answer
3k views

Yet another 'any' class implementation, named 'some'

This is a follow-up of 'any' class implementation. After posting my answer, I kept working on the code towards parameterizing with respect to memory management as I had promised. I ended up in some ...
iavr's user avatar
  • 2,284
27 votes
1 answer
20k views

Efficient smart pointer implementation in C++

The idea behind this is mainly educational but I might even consider using it in reality if turns out to be good. Here's my first try at implementing smart pointers: ...
mmirzadeh's user avatar
  • 411
10 votes
3 answers
7k views

Simple Pool Allocator

This is a simple pool allocator, based (to at least some degree) on a previous answer. The basic idea is pretty simple: allow a user to allocate objects of some type quickly (in relatively large ...
Jerry Coffin's user avatar
  • 33.6k
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 ...
Scholar's user avatar
  • 83
8 votes
3 answers
969 views

Non-fragmenting pool allocator

This is a fairly straightforward object allocator/factory, which sets up a stack of freed nodes as a linked list in the unused part of the storage. I would appreciate any and all feedback you may have....
user avatar
6 votes
4 answers
8k views

Texture managing

I'm new to C++ and SDL, and I've written a Texture manager class whose purpose is to help me manage sprites and other textures. I have a ...
MattMatt's user avatar
  • 593
4 votes
1 answer
167 views

Track and trace allocations

When testing or debugging allocator-aware objects, it can be useful to provide allocators that can provide insight into how they get called. The Tracing_alloc from ...
Toby Speight's user avatar
  • 77.3k
4 votes
2 answers
487 views

Reusable storage for array of objects

My goal is to have a memory pool non-template class that is used to store arrays of objects. The same memory pool object must be reusable for a different array (difference size, different type and/or ...
Oersted's user avatar
  • 337
3 votes
1 answer
66 views

Reusable storage for array of objects V2

Here is a follow up on Reusable storage for array of objects, taking into account the provided answers. The following code should be compliant at least with gcc, <...
Oersted's user avatar
  • 337
12 votes
2 answers
2k views

Implementation of a lock-free fixed-sized allocator

This question now has a follow-up: Implementation of a lock-free fixed-sized allocator - follow-up - with commented code I've tried implementing a lock-free fixed-size allocator while trying to ...
cr_oag's user avatar
  • 565
11 votes
5 answers
2k views

Static factory function and lifetime

I'm trying to teach myself C++ at the moment, after years of C# and other managed languages. The class in question is a Level in a game, and the idea is to ...
Michael Stum's user avatar
10 votes
1 answer
263 views

C++ imitation of glibc malloc(), free()

I wrote a C++ simulator that performs algorithms for glibc malloc() and free(). The core logic is basically the same, with the ...
frozenca's user avatar
  • 1,703
8 votes
2 answers
2k views

Leak detection simple class

Basic idea is to use a Class, with static methods to add and remove references in a static vector, that keeps track of these references, and check that vector upon exit. The class is detecting ...
User's user avatar
  • 93
7 votes
2 answers
9k views

Simple C++ object pool

I am studying computer science and just for the sake of practise I thought of implementing an object pool. This is my first implementation, it is simple and works correctly, but I would love any ...
amc176's user avatar
  • 345

15 30 50 per page