Category : allocation

I wrote: class image { public: linked_list<int, int> UnLabeledList; int *SegArray = nullptr; int Total_Segments = 0; explicit image(int Segments) : SegArray(new int[Segments]) { Total_Segments = Segments; for (int i = 0; i < Segments; ++i) { if (!UnLabeledList.push_back(i, NOT_INIT)) { // allocation failed for one node (Doesn’t throw any exception) ~UnLabeledList(); delete[] SegArray; throw; ..

Read more

I am trying to implement my own linked list, and had confusion with few things. Here is part of my current implementation: /** Copy Constructor – Uninitialized Object**/ linked_list(const linked_list &l_list) { total_nodes = 0; first = new node<S, T>{}; //Dummy first->height = NOT_INIT; //For debugging last = first; node<S, T> *tmp = l_list.first->right_node; while ..

Read more

The below code is using a handler that provides a custom allocator. The allocator is provided with an instance of BucketPool that can allocate different sizes, but the sizes of the allocations that can be made needs to be specified at compile time. So to use BucketPool I would just specify some arbitrary template parameter, ..

Read more