Please, can anyone convert this code for me?
I don’t know so much about C++, so I need to convert this code from C++ to delphi:
template <typename DestType, typename SrcType>
DestType* ByteOffset(SrcType* ptr, ptrdiff_t offset)
{
return reinterpret_cast<DestType*>(reinterpret_cast<unsigned char*>(ptr) + offset);
}
Thank you…
It’s actually pretty simple to convert, but you can’t use templates in Delphi. It is merely adding an offset to a pointer, but the offset is specified in bytes rather than multiples of the pointer base type.
So convert
into
Some more examples:
and so on.