Code Snippets

Below are code snippets taken from a small project where I create a random person with a job using templates, inheritance and smart pointers. This pattern allows me to iterate on each person without needing to worry about the underlying implementation while also preserving the ability to extend the job pool.

In this snippet I create a village with people in it and simulate them using the previous snippets setup and using the RVO rule i make sure to avoid triggering atomic increments in the smart pointers.

Below is a container class that translates a single vector to a fixed size 2D grid.

This grid class is meant to be representing a 2D world and have therefore not specified a iterator, which would also lead to confusion of the container in itself. Instead if all the elements need to be iterated upon i provided the option to do so via lambda callback implementation as seen below