All Questions
94
questions
2
votes
1
answer
99
views
Decoupling receiving data and processing data by passing callback and shared_ptr
Sorry for my poor English. I want to decouple receiving data and processing data, this is the demo code:
...
6
votes
2
answers
2k
views
shared_ptr and make_shared implementations (for learning)
Recently, I've been going through Scott Meyer's Effective Modern C++ and found the discussion on shared_ptr really interesting. I also watched Louis Brandy's ...
1
vote
1
answer
434
views
Implementing a binary search tree using std::unique_ptr
I have implemented a binary search tree with 2 operations to begin with. I have tried to implement it using the best practices I could think of. Overall, I am happy with the implementation. But, I ...
5
votes
3
answers
4k
views
Implementing Sample Abstract Factory Pattern using Smart Pointers in C++
Was trying to implement and example code to smart pointer from link.
Is it a good practice? To go with all unique pointers or should we use shared pointers in this case? How can i improve this ?
<...
5
votes
0
answers
1k
views
Polymorphic deleter for unique_ptr
There is a basic difference in the way C++ manages the deleter for std::unique_ptr and std::shared_ptr, mainly for allowing ...
3
votes
2
answers
640
views
Merge Sort C++11 C++17
Question
Any way I can optimize this further using new C++11 or C++17 features? Would also like feedback on my variable naming, memory management, and style (notice my placement of ...
6
votes
3
answers
5k
views
Array Dynamic resize in heap
I have answered a Question in Stackoverflow link.
a) Create a function called resize that can be used to increase the
size of integer arrays dynamically. The function takes three
parameters. ...
3
votes
2
answers
279
views
Mario Party Snake and Ladders Board
Context
Was inspired from this LeetCode post to do my own System Design exercise of the common Snake and Ladders problem. As I was writing the code Mario Party kept coming to mind so I added a little ...
5
votes
1
answer
1k
views
C++ shared_ptr memory pool
I put together this little memory pool class to help avoid the costs associated with heap allocation and deallocation of objects that are frequently created & destroyed. It creates C++ standard <...
4
votes
2
answers
224
views
Simple device (fancy) pointer implementation
device_raw_ptr is a simple fancy pointer. It essentially wrap pointers to GPU memory. It's sole purpose is to separate out host pointers from device pointers, i.e. ...
5
votes
3
answers
814
views
Stack Interview Code methods made from class Node and Smart Pointers
Mainly looking for feedback on my use of smart pointers to implement a standard stack. For interview level production code I have also include a namespace and asserts to test my class, let me know if ...
5
votes
1
answer
155
views
wrapper for common subset of auto_ptr and unique_ptr API
I read an interesting old question on the Software Engineering SE about how to transition away from std::auto_ptr. So I wrote a wrapper around the common subset of <...
2
votes
1
answer
56
views
Queue Interview Code basic methods made from struct Node optimized
Using feedback from my previous implementation I'm writing a very simple Queue of struct Nodes with only these methods get_front(), get_back(), pop_front(), push_back(), and a ostream friend method. I ...
1
vote
2
answers
154
views
shared_ptr basic implementation for non array types
This is an implementation to simulate the basic functionality of c++ shared_ptr.
This doesn't provide features like custom deleter and make_shared().
I would really appreciate any feedback to improve ...
3
votes
3
answers
150
views
Linked List Interview Code methods, runtime, and edge cases refactored
In my previous post I had a number of steps given to me from the accepted answer on how I can write more production ready code. In this post I want this code to be reviewed as near production code I'd ...