mercredi 2 février 2022

Raw pointer but modern way

I have to have a semantic stack in my project which is going to hold multiple types in it.
I aim to have my project to use modern C++.
What is the correct way to have a stack of any type ?
Equivalent version in java is Stack<Object>.
Which of these are correct?

  1. Use void* and cast it to the type I want.
  2. Something as 1 but using some smart pointers. (I don't know what)

Aucun commentaire:

Enregistrer un commentaire