Skip to main content

All Questions

2 votes
0 answers
48 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 ...
Oersted's user avatar
  • 337
1 vote
1 answer
48 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 ...
Oersted's user avatar
  • 337
3 votes
1 answer
66 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, <...
Oersted's user avatar
  • 337
4 votes
2 answers
487 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 ...
Oersted's user avatar
  • 337
7 votes
2 answers
203 views

shared_ptr implementation code - first cut

I've written an implementation of shared_ptr. It doesn't support weak_ptr (yet) but below is the code. I'd appreciate any feedback, comments. ...
Greg's user avatar
  • 71
-1 votes
1 answer
289 views

Copying allocated data into std::map in a smart way [closed]

I come across a problem and I solved it. The solution works but I have some feelings that there is something wrong with my solution/code. To be clear, let's assume that cars on the race track transmit ...
unique's user avatar
  • 153
6 votes
3 answers
2k views

Implementation of a shared pointer constructors and destructor

I am writing my simple shared pointer. I am asking to review existing functions (understand that my implementations is not full, e.g now operator*) Review please ...
mascai's user avatar
  • 379
1 vote
2 answers
300 views

Improvement suggestions to my shared_ptr and weak_ptr implementations

Below is the entire code. I appreciate if, someone with more C++ experience can suggest if this can be improved further and if you notice any issues. controlblock.hpp ...
Albin M's user avatar
  • 135
5 votes
2 answers
836 views

C++ Garbage Collector - Simple Automatic Memory Management

I made a general smart pointer which fixes the problems of loops between std::shared_ptr's. While use is simple, I feel that my code is inefficient and clumsy. Here ...
Captain Hatteras's user avatar
4 votes
2 answers
567 views

"observer pointer" meant to stay updated when the pointed object is moved in memory

I wasn't sure about how to name it, maybe "follow_ptr", "self_updating_ptr", or "stalking_ptr" or something on those lines. For now it's called Identifier. What I'm ...
Barnack's user avatar
  • 217
2 votes
4 answers
131 views

I'm deallocating objects created but I'm unsure whether my code is leaking memory or not

I have a simple application which requires the user to input details about students and their grades. I have two different classes Student and ...
mhmrhiman's user avatar
2 votes
0 answers
108 views

A lightweight version of std::shared_ptr<T> V2

This is a lightweight version of std::shared_ptr<T> called res_ptr<T> This post is a continuation of: A lightweight ...
ALX23z's user avatar
  • 2,368
4 votes
3 answers
465 views

Simple shared pointer implementation in a single threaded environment (revised)

std::shared_ptr does not stop you from having the same resource managed by multiple control-blocks (and thus independent sets of shared-pointers), even though it is ...
frank's user avatar
  • 85
7 votes
2 answers
577 views

A lightweight version of std::shared_ptr<T>

I wrote a simple lighter version of std::shared_ptr<T> called res_ptr<T>. ...
ALX23z's user avatar
  • 2,368
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

15 30 50 per page