Skip to main content

All Questions

Tagged with
17 votes
2 answers
3k views

boost::any replacement with std::unique_ptr support

I needed a boost.any look-a-like, that could handle a std::unique_ptr. I came up with this. Please provide some C++11 criticism. ...
user1095108's user avatar
  • 1,434
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
15 votes
2 answers
1k views

C++11 smart pointer 'library'

Edit: NOTE I'm a C++ "beginner" still in undergrad trying to teach myself modern C++ (because they don't do that in uni) so I'm sure this is riddled with errors that I am unaware of. Made a subset of ...
sjh919's user avatar
  • 153
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
11 votes
5 answers
3k views

Custom class for a borrowed unique_ptr<T>?

In C++11, I tend to have master objects that maintain sole ownership of a collection of some children objects. Let's assume these children objects are non-copyable (for instance, ...
Max's user avatar
  • 213
11 votes
2 answers
3k views

Trie Data Structure Implementation in C++11 using Smart Pointers -- follow-up

Link to my first question. Link to my latest source code. I followed @JDługosz recommendations. How does it look? Do you have any further recommendations? Is it better (if possible) to replace ...
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
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
11 votes
2 answers
1k views

make_auto implementation for C++03 compilers

I want to provide, in the the spirit of C++11/boost make_shared and C++14 make_unique, a production-ready make_auto for C++03 compilers. So, inspired boost's make_shared implementation for C++03 ...
paercebal's user avatar
  • 281
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
10 votes
3 answers
9k views

Implementing a binary tree in C++ using "std::unique_ptr"

I have implemented a simple binary search tree class in C++ using std::unique_ptr objects to hold the pointers to each node. In doing this I have come across a ...
tjwrona's user avatar
  • 499
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
9 votes
3 answers
3k views

Binary Search Tree implementation using smart pointers

I have implemented below code for binary search tree implementation using shared pointer. At present, I have considered only integers. It supports insertion and deletion of values. Also, a print ...
bornfree's user avatar
  • 229
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
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

15 30 50 per page
1
2 3 4 5
7