标题已经说过了。
如何在不使用const_cast或c-style强制转换的情况下打开const void *?
示例代码:
int test(const void * ptr){ switch(ptr){ 案例0: 返回0; …
你不能。
你只能 switch 在上下文中可转换为整数类型的东西,和 const void* 不是其中之一。
switch
const void*