我使用结构来公开 typeafish 接口,例如:
class IFoo
{
virtual HRESULT bar(struct _BAR * arg) = 0;
}
在幕后,这个接口的每个实现都定义了自己的结构:
struct _BAR { Baz baz };
我目前以这种方式调用许多分配函数:
HRESULT allocate(Baz ** baz);
_BAR * bar;
ret = allocate( (Baz **) &bar );
static_cast是否可以通过在定义中添加数据来使用更安全的类型转换来调用它们struct _BAR?