All Questions
95
questions
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.
...
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 ...
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 ...
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 ...
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, ...
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 ...
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.
...
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 ...
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 ...
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 ...
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 ...
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.
...
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 ...
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 ...
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 ...