Skip to main content

All Questions

0 votes
1 answer
545 views

Count the number of objects created statically and dynamically in C++

I have written below program to count the number of static and dynamically created object of the class. ...
Naveen Gupta's user avatar
6 votes
1 answer
339 views

Safe new/delete

A student was having problems with memory management so I put together an overload of global operator new and global ...
Aykhan Hagverdili's user avatar
5 votes
0 answers
1k views

Polymorphic deleter for unique_ptr

There is a basic difference in the way C++ manages the deleter for std::unique_ptr and std::shared_ptr, mainly for allowing ...
Amir Kirsh's user avatar
1 vote
1 answer
131 views

Boolean class using shared referenced memory

To improve my knowledge I am trying to make a bool class from scratch, or derivative of. I am using MinGW g++11 compiler on a Windows 7 laptop. ...
Danilo's user avatar
  • 195
5 votes
1 answer
1k views

C++ shared_ptr memory pool

I put together this little memory pool class to help avoid the costs associated with heap allocation and deallocation of objects that are frequently created & destroyed. It creates C++ standard <...
Thomas Johnson's user avatar
2 votes
0 answers
319 views

Yet Another Non-Intrusive Reference Counted Smart Pointer Implementation

I needed a reference counted smart pointer for my project, and for some reason early in my project, I decided that I did not like the std::shared_ptr. I can't ...
Super Cyb0rg's user avatar
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 ...
internet_user's user avatar
9 votes
2 answers
6k views

Fast pool allocator for games in C++

I have implemented the following pool allocator in C++: ...
Peter Lenkefi's user avatar
3 votes
0 answers
320 views

C++ object pool using C memory pool as base

I started out with this question on Stack Overflow. I have since then gotten an official answer from the mbed developers that the MemoryPool that I was asking about only issued raw C malloc/free type ...
paulluap's user avatar
2 votes
1 answer
514 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 ...
amc176's user avatar
  • 345
13 votes
1 answer
3k views

C++ class for aligning objects on the stack

I wrote a short class which allocates objects on the stack and aligns them to a specific memory address. Alignment makes sense for some objects (i.e. some SIMD intrinsics require aligned data). I ...
cruppstahl's user avatar
6 votes
2 answers
16k views

C++ Trie using std::map and std::unique_ptr

I'm learning C++ and whilst trying to write in modern C++, I've made an attempt to rewrite a trie implementation written in C found here: http://www.geeksforgeeks.org/trie-insert-and-search/ It uses ...
Cyniscus's user avatar
2 votes
2 answers
989 views

A simple C++ Trie for working with strings

Here is a simple C++ 11 trie for insertion and membership testing: ...
Marcus Handley's user avatar
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. ...
ankit srivastava's user avatar
13 votes
2 answers
920 views

Dynamic memory management for a class hierarchy of geometric shapes

The task was to write function that compare areas of two random generated geometric shapes (circle, square, rectangle) using base class with virtual function. Am I doing it right in terms of memory ...
Paweł Dymowski's user avatar

15 30 50 per page