Casting void pointers, depending on data (C++)
问题 Basically what I want to do is, depending on the some variable, to cast a void pointer into a different datatype. For example (the 'cast' variable is just something in order to get my point across): void* ptr = some data; int temp = some data; int i = 0; ... if(temp == 32) cast = (uint32*) else if(temp == 16) cast = (uint16*) else cast = (uint8*) i = someArray[*((cast)ptr)]; Is there anything in C++ that can do something like this (since you can't actually assign a variable to be just (uint32