mercredi 4 février 2015

How to deal with a generic object in C++

What is the proper way to deal with a generic value in C++11 or is it OK to use (void *)?


Basically, I am parsing json, and the node value can either be String, Integer, Double, Date, etc.


In C, just using void * is OK (not safe, but ok), and in C# we use Object. But what is the proper way in C++11 to do this? Do I have to build a wrapper class, or is there an easier way?


Aucun commentaire:

Enregistrer un commentaire