All Questions
Tagged with array memory-management
37 questions
1
vote
0
answers
67
views
Presence of UB and memory usage of a std::array initialization: version with temporary array on heap
I proposed several techniques to answer to https://stackoverflow.com/q/78672409/21691539.
A classical way to answer would be to use std::index_sequence-based ...
3
votes
1
answer
240
views
Presence of UB and memory usage of a std::array initialization
I proposed several techniques to answer to https://stackoverflow.com/q/78672409/21691539.
A classical way to answer would be to use std::index_sequence-based ...
2
votes
0
answers
53
views
Reusable storage for array of objects V4
Here is a thirdfollow up on Reusable storage for array of objects, Reusable storage for array of objects V2 and Reusable storage for array of objects V3, taking into account the provided answers.
The ...
1
vote
1
answer
55
views
Reusable storage for array of objects V3
Here is a second follow up on Reusable storage for array of objects and Reusable storage for array of objects V2, taking into account the provided answers.
The following code should be compliant at ...
3
votes
1
answer
72
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, <...
4
votes
2
answers
509
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 ...
10
votes
5
answers
3k
views
Implementation of a two-dimensional array in C
I implemented a two-dimensional array in C and would like to know if the implementation is sound in terms of
Memory management
Potential bugs and other side effects that I missed
Code style (...
6
votes
3
answers
2k
views
Dynamic array implementation using C++
I implemented a basic dynamic array using C++.
When deleting an element and shifting the others, the last element will be twice repeated (the original still exists after copying). I want to avoid ...
1
vote
1
answer
759
views
dynarr - yet another simple C dynamic array library
I wrote my own dynamic array library for C as I was not happy with the others I found. It is very crude but the basic logic should be correct, it mainly revolves making ...
3
votes
1
answer
164
views
Smart/Dynamic array in C
I attempted to make a smart/dynamic array implementation in C which is supposed to be a hybrid between a C++ vector/stack/queue.
This is what i came up with:
Header (smart_array.h):
...
5
votes
3
answers
140
views
Removing unneeded objects from an array before rendering
I'm making a function that adds a new object to an array and removes the oldest if it has reached a specific length. Click the button in the example below. All objects are drawn until its array ...
2
votes
1
answer
143
views
A heap-allocated texture class for a console renderer
I am working on a console renderer and I want a heap-allocated dynamic texture class. Since I am quite new to C++, I just want to check the memory management, if I destroy all pointers correctly etc.
...
8
votes
1
answer
862
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. ...
5
votes
2
answers
1k
views
A static array implementation in C++
I'm implementing a basic array data structure with basic functionalities.
...
1
vote
1
answer
48
views
Dynamically-resizable array implementation, for use in a game-dev-related library
I've been working on a library that includes a list-like structure, which I use internally multiple times to store different types of structs. However, I'm not entirely confident with my ability to ...