作者热门文章
- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我使用的代码将派生对象数组视为基础对象数组。两个对象的大小相同。我想知道:
这是我的例子:
BOOST_STATIC_ASSERT(sizeof(VARIANT)==sizeof(CComVariant));
//auto_array deletes[] the pointer if detach() isn't called at the end of scope
auto_array<CComVariant> buffer(new CComVariant[bufferSize]);
//...Code that sets the value of each element...
//This takes a range specified as two VARIANT* - the AtlFlagTakeOwnership option
//causes delete[] to be called on the array when the object pEnum referes to
//is released.
pEnum->Init(buffer.ptr,buffer.ptr+bufferSize,0,AtlFlagTakeOwnership);
buffer.detach();
最佳答案
是的,CComVariant 旨在直接替代 VARIANT。它派生自变体结构,不添加任何虚拟成员或字段(也没有虚拟析构函数)以确保内存布局相同。许多类似 ATL/MFC 中的小帮助类,如 CRect、CPoint 等。
关于c++ - 当大小相同时使用派生对象数组作为基础对象数组 (CComVariant/VARIANT),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2957062/
现在我正在尝试实现 flash programming specification对于 PIC32MX。我正在使用 PIC32MX512L 和 PIC32MX512H。 PIC32MX512L最终必须
我是一名优秀的程序员,十分优秀!