Skip to main content

All Questions

Tagged with
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 ...
user6245072's user avatar
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 ...
Andrew's user avatar
  • 143
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: ...
Jan Rüegg's user avatar
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 : ...
user avatar
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. ...
Klemens's user avatar
  • 125
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
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 ...
user695652's user avatar
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
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. ...
user2296177's user avatar
  • 3,543
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 ...
Unbreakable's user avatar
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. ...
Matthew James Briggs's user avatar
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 ...
Loki Astari's user avatar
  • 95.4k
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.,...
Simon's user avatar
  • 153
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 ...
Daniel Martin's user avatar
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 ...
rcanepa's user avatar
  • 168

15 30 50 per page
1 2 3
4
5
7