samedi 4 juillet 2015

Finding the type of a pointer

I want to do something like this:

SomeType *y;

/* ... snip ... */

auto x = new decltype(y); // Create a new pointer "x" to a SomeType object.

But decltype(y) is SomeType* and decltype(*y) is SomeType&. Is there a way to get plain SomeType out of y?

Aucun commentaire:

Enregistrer un commentaire