Skip to main content

All Questions

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
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
-1 votes
1 answer
4k views

Using shared_ptr as class member [closed]

I have already got the answer for my previous question, and I decided to use std::vector<int> instead of int *. I have ...
AnatoliySultanov's user avatar
5 votes
2 answers
233 views

NamedPoint class using unique_ptr for members

After reading this old article from 2001 I have tried to implement the class from it using unique_pointer. An author's claim is that C++ is not appropriate for ...
shtkuh's user avatar
  • 165
2 votes
1 answer
242 views

Pointer lists for a C++ garbage collector

The problem My intention is to have a class A and class B. class B has a ...
peterh's user avatar
  • 237
5 votes
2 answers
674 views

Singleton typed memory manager

For my resources management, I wanted the objects allocated on the heap to be in a contiguous block of memory. Obviously, each data type then has to have their own chunk of memory. I could have used a ...
rashmatash's user avatar
3 votes
1 answer
1k views

Auto-recycling C++11 polymorphic smart pointers

I've recently read an interesting blog post by Philipp Zschoche: it explains how it's possible to avoid unnecessary allocations/deallocations by keeping track of previously allocated memory in a stack....
Vittorio Romeo's user avatar
8 votes
1 answer
2k views

Smart pointer memory pool

I'm using a third-party library which utilizes boost::shared_ptr for memory management. The problem is that I need to allocate many objects and I have detected ...
dalle's user avatar
  • 233
7 votes
2 answers
2k views

Am I using copy ctors/move ctors/shared_ptr correctly?

Here is my simple example: there is a class A with few primitive members and a class B with few primitive members but also a collection of objects of type A. This is my A class: ...
Jack Willson's user avatar