All Questions
95
questions
1
vote
3
answers
107
views
Implementing my own shared-ownership double-indirecting smart-pointer
I am implementing my own double-indirecting shared-ownership smart-pointer because I needed a way to replace the managed object a group of smart-pointers is pointing to with a new object (it's the ...
4
votes
1
answer
3k
views
C++ lock wrapper class around pointer
I have created a class which wraps pointers and behaves like a pointer would behave, minus a few cases. It is a lock wrapper class which simply locks before usage of the pointer and unlocks once the ...
0
votes
1
answer
206
views
RAII object for releasing pointer with arbitrary function
The following class is a sort of "smart pointer" that can be used for automatically releasing pointers:
...
5
votes
2
answers
9k
views
shared_ptr code implementation
I have never used std::shared_ptr before and I don't really know how this smart pointer actually works but I decided to create one to verify my knowledge. Here is my code :
...
2
votes
1
answer
3k
views
List implementation with shared_ptr using C++11
I wrote list, which I think is more elaborate than usual. I would like to ask you for some tips, criticisms, and general feedback about my code.
...
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 ...
11
votes
2
answers
708
views
Beep-beep I'm a car factory
I have implemented to following generic factory in C++11 using smart pointers and I would like to get some feedback about it.
(Please note that I can't use C++14)
Due to company policies I have to ...
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 ...
10
votes
2
answers
1k
views
An optional<T> implementation
This is an implementation of optional<T> from C++17, it is mostly standard conforming.
I'm looking for a review on efficiency, correctness and performance.
...
1
vote
1
answer
135
views
Operator Oveloading: "+" and "==" for two classes
I have one class Number (base class) and two child class Fraction and ...
11
votes
3
answers
17k
views
DeepPtr: a deep-copying unique_ptr wrapper in C++
When using the pimple idiom it is necessary to represent your "impl" as a forward declared pointer in the header file. This necessitates a lot of boilerplate code to implement the rule of five.
...
8
votes
2
answers
490
views
Smart pointer or how not to leak a pointer
Wrote a couple of blog articles about smart pointers.
Unique Pointer
Shared Pointer
Constructors for Smart Pointers
So I suppose it time to get the result reviewed.
This is not supposed to be a ...
5
votes
2
answers
8k
views
Implementation of unique_ptr and make_unique for aligned memory
I am working on a version of std::unique_ptr and std::make_unique for aligned memory. The purpose of this is vectorization, e.g.,...
1
vote
1
answer
9k
views
Casting between types for shared_ptr
I'm implementing an Entity-Component-System. Basically, an entity is a wrapper around an ID, a component is just a POD struct, and a System is a class that does work on components corresponding to the ...
5
votes
1
answer
3k
views
Single LinkedList using smart pointers
In order to learn C++11, I propose to myself implement a simple single linked list using smart pointers. The idea was to cover the basic operations without leave any memory leak.
I came up with a ...