Skip to content

Move from Raw Pointers to Shared Pointers

Simon Spannagel requested to merge play_with_fire into master

This MR changes the basic data structure from pointer-to-vector-of-raw-pointers to vectors-of-shared_ptr. This has some implications:

  • lots of ugly checks for nullptr removed from module code
  • removal of ugly de-referencing of pointers (for(auto& a : (*b)) {} to for(auto& a : b) {})
  • objects are created on stack which makes it faster -- and offsets the slowness of using shared_ptr. I.e. performance stays the same.
  • automatic garbage collection - less potential for memory leaks. 🎆

We cannot move to vector-of-objects because we need polymorphism for our track class implementations.

Merge request reports