Skip to main content

All Questions

Tagged with
3 votes
2 answers
1k views

C++11 Singly Linked List with raw pointers

Regarding C++, I have an experience in writing only short non-object-oriented programs and competitive programming challenges. I would like to get your feedback about my C++ style, design decisions, ...
pkacprzak's user avatar
  • 161
16 votes
1 answer
1k views

value_ptr<T> - a C++11 header-only, deep-copying smart pointer that preserves value semantics for polymorphic and undefined types

== UPDATED: next revision HERE == My previous two iterations were here and here. I've since finalized the concept as described in the title, and would appreciate any feedback on the new solution ...
Tom's user avatar
  • 417
5 votes
1 answer
248 views

deep_ptr<T>; a header-only, deep copying, value semantic smart pointer for optionally defined types

Edit: final revision here A couple days ago I posted a similar question here. Since then, I have refined the implementation a bit further, as the solution I had previously posited was a bit off ...
Tom's user avatar
  • 417
7 votes
3 answers
5k views

Custom std::shared_ptr<T> implementation

I'd like to get a few pointers about my code. I know that shared_ptr is up and running, and I'm reinventing the wheel but you can't say no to the school assignment. ...
gMD's user avatar
  • 71
14 votes
2 answers
29k views

My implementation for std::unique_ptr

I just finished learning about move semantics and realized that a nice practical example for this concept is unique_ptr (it cannot be copied, only moved). For ...
Matias Cicero's user avatar
10 votes
3 answers
3k views

Implementing a Stack with Templates and Smart pointers

I'm trying to understand the concepts of smart pointers and templates. To get a better understanding of these, I tried to implement these two concepts on Stack. I ...
user3898160's user avatar
4 votes
2 answers
2k views

Implementing a shared_ptr class in C++

I'm trying to write my own shared_ptr/weak_ptr implementation in C++. I have the following requirements: I do NOT need support for the following: multithreading (synchronisation) support for ...
Truncheon's user avatar
9 votes
2 answers
3k views

C++ Linked list with smart pointers

This seems to work fine, but I'm very new to C++ and would like any suggestions for improvements. Areas I have the most trouble with are: Namespacing (honestly, it's still half looking stuff up and ...
Bill Harper's user avatar
6 votes
1 answer
676 views

C++ maybe pointer type implementation

Motivation This is intended to implement a C++ maybe_ptr type that can either hold a pointer to an underlying type T or a ...
n00b101's user avatar
  • 163
2 votes
1 answer
4k views

Thread class that uses std::unique_ptr

I have implemented a class which encapsulates a thread of execution and provides an interface to send messages to it. It is based largely on an article written by Herb Sutter in 2010. It also uses the ...
ksl's user avatar
  • 141
3 votes
2 answers
6k views

Custom STL Vector in C++

This is my first time I tried to implement a custom STL vector with iterator. I have some questions: What are better ways to write an iterator? I know that there is a ...
Newbie's user avatar
  • 700
0 votes
1 answer
3k views

Implementing a single linked list using smart pointers (replace std::shared_ptr with std::unique_ptr)

As an example code I've given here, I have the feeling the use of std::shared_ptr is wrong and should be replaced using a ...
πάντα ῥεῖ's user avatar
1 vote
1 answer
5k views

Smart Pointers Queue Implementation

To practice around with C++11 smart pointers I was trying to implement a simple Queue to go beyond a simple Linked List. The fact that the _first and ...
user49428's user avatar
8 votes
3 answers
243 views

Multiplayer GameObject design

I created a really basic game class. A game has GameObject instances, which currently have a position only. This code is running on the client, and in each loop ...
Iter Ator's user avatar
  • 271
-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

15 30 50 per page
1 2
3
4 5
7