Returning different data type depending on the data (C++) <p>Is there anyway to do something like this?</p> <pre><code>(correct pointer datatype) returnPointer(void* ptr, int depth) { if(depth == 8) return (uint8*)ptr; else if (depth == 16) return (uint16*)ptr; else return (uint32*)ptr; } </code></pre> <p>Thanks</p>