All Questions
Tagged with memory-management vectors
17 questions
3
votes
1
answer
344
views
First dynamic array in C
I am new to C and have been learning it for about a month now.
This is my attempt to implement a dynamic array. My code works, but i don't know whether or not it leaks memory.
But my code works as I ...
1
vote
2
answers
635
views
C ArrayList implementation
I have written a ArrayList class in C and I just wanted some criticism on what I can improve on. Any criticism helps, and I was wondering if there is any better way of doing error handling other than ...
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 ...
4
votes
1
answer
279
views
C++ Dynamic Array Class Testing
I'm creating a basic Dynamic Array class in C++, and I'd like to know if there are any bugs/memory leaks I haven't noticed yet.
dyn_arr.h :
...
2
votes
1
answer
207
views
dumb::vector - a class for students to use when they are expressly forbidden from using std::vector
I have created a small library for use by beginner C++ students who are forbidden from using std::vector in their projects. Because of this, I would like you to ...
4
votes
3
answers
1k
views
Fast-resizing uint8 buffer
I wanted a buffer like std::vector<uint8_t> which is very fast at resizing, and it does not require byte initialization (it resizes to 16K, then to 2-4 bytes, ...
1
vote
1
answer
138
views
Header-only vector implementation in C
I tried to make a generic, header-only vector thingy I can use in other projects in the future. I omitted documentation comments because it's already quite long.
...
28
votes
5
answers
5k
views
C++ Vector Clone
I'm learning C++, so I decided to make a simpler clone of std::vector.
Concerns:
I have seen people defining methods outside of the class, and only prototyping ...
2
votes
1
answer
9k
views
Vector with move constructor and move assignment operator [closed]
Please verify whether the code for a move constructor and a move assignment operator is correct.
...
7
votes
2
answers
2k
views
Fast variable-length stack allocator for vector<> in C++
I wrote a variable-length stack allocator for the vector<> class in C++ 11. In order to be able to allocate size dynamically at runtime I made use of the non-...
2
votes
2
answers
2k
views
Simple class to mimic a dynamic array
for my c++ class I was asked to write a class with the following characteristics:
Implement a vector replacement that operates only on integers (you don't need to use templates like the normal STL)...
2
votes
2
answers
2k
views
Using std::vectors to store textures
I need to write a TextureManager class which stores Texture objects; the problem is I'm using an ...
6
votes
2
answers
524
views
Vector backed by memory pages
The purpose of this class is to wrap a std::vector in a class so that never a new object is added. We don't allocate a new object on the stack but we trying to fit ...
6
votes
4
answers
41k
views
Creating a custom Vector class
I'm new to C++ and am doing the C++ 4th Edition Stroustrup book. I expanded on one of the examples, and have a few questions to ask (embedded within the code: ////QUESTION 1-9).
Please provide any ...
2
votes
2
answers
2k
views
split string into container on char; efficiently?
Here is my single parse code for splitting a std::string on a char into a ...
7
votes
2
answers
23k
views
Template vector class
I am trying to implement a vector-like container of my own (just to gain a better understanding of how std::vector works under the hood). I've been using this as a ...
4
votes
4
answers
2k
views
Reducing memory usage of nested vectors
I recently asked this question about performance of an unordered_map, but I realize my question is probably more about this piece of code here.
I create a 8 x 10 x 30 x 30 x 24000 nested vectors of ...