【发布时间】:2012-02-28 12:37:58
【问题描述】:
请问,谁能帮我转换一下这段代码?
我对C++了解不多,所以需要把这段代码从C++转成delphi:
template <typename DestType, typename SrcType>
DestType* ByteOffset(SrcType* ptr, ptrdiff_t offset)
{
return reinterpret_cast<DestType*>(reinterpret_cast<unsigned char*>(ptr) + offset);
}
谢谢...
【问题讨论】:
-
Delphi 没有模板,无法直接转换代码。要继续,我们需要查看代码是如何使用的。
-
@DavidHeffernan,此函数中使用此代码:pastebin.com/7d9N1J2c"eat_hook"
-
虽然这看起来很复杂,但这个函数只是为指针添加了一个偏移量,与指针类型无关。
-
@ereOn,在delphi中怎么样?谢谢
标签: c++ delphi templates pascal