我正在尝试使用static_cast转换uint8_t*为Some_Type_T*
where Some_Type_Tis a struct。
SomeType_T* pTarget = static_cast<SomeType_T*>(pData)
这给了我一个错误
invalid static_cast from type 'uint8_t [1000] {aka unsigned char [1000]}' to type 'Some_Type_T*'
基本上我想要实现的是将缓冲区(字节数组)映射到某个结构。
我已经用 C 类的演员做过很多次了。但我虽然static_cast<>更安全。
你能告诉我为什么这不起作用吗?