All Questions
Tagged with pointers design-patterns
10 questions
4
votes
1
answer
116
views
Maze game from book Design Patterns with smart pointers and polymorphism
The Design Patterns book chapter 3 about Creational Patterns starts with a maze game. They use the maze as an example throughout the chapter and instead of rooms they have also things like enchanted ...
3
votes
1
answer
183
views
Implementing The Decorator Design Pattern in C++
I recently tried to implement the decorator design pattern in C++. Here is the code in full:
...
0
votes
0
answers
618
views
Inheriting from a JSON converter class with schema definition through constructor
I wanted to convert C++ data structures to JSON with little code. More specifically, I wanted to convert C++ data structures to nlohmann JSON representation.
Project context: The goal is to use this ...
0
votes
2
answers
583
views
Binary Search Tree implementation with unique pointers
I have implemented a binary search tree using templates and unique_ptr in C++ 11. At present, only insertion and deletion are implemented. Please provide your feedback for improvements.
...
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 ...
3
votes
1
answer
1k
views
Simple packet parsing command pattern
I'm currently creating a small server back-end. My goal is to write an (efficient) packet parser in C++17 using the command pattern. The packets are given by:
...
5
votes
1
answer
1k
views
Strategy design pattern in C++ using unique_ptr
#1. Introduction
This is for my ANN project.
Each building block of ANN, neuron, has activation function which determines how to get the output given the input (see formula in on repo I linked).
I ...
6
votes
3
answers
1k
views
View programming pattern in C++ without raw pointers
I'm trying to achieve, for lack of a better term, a "view" pattern in C++. It's probably most comparable to "views" in the Database world, where one can make a query, and then perhaps aggregate the ...
0
votes
1
answer
2k
views
Polymorphic template cloning class
I have a requirement of a templated clone() method which Base classes can implement through an ICloneable interface and all the ...
7
votes
1
answer
2k
views
Builder/named argument/fluent interface pattern with unique_ptr
I'm trying to figure out the cleanest way to implement a fluent interface with unique_ptr and other "modern" C++ language constructs. Here's my first attempt:
<...