Getting byte size of POD classes and dynamic arrays
Byron Heads
byron.heads at gmail.com
Thu May 16 06:21:44 PDT 2013
On Thu, 16 May 2013 08:11:35 -0500, 1100110 wrote:
> On 05/16/2013 08:09 AM, Byron Heads wrote:
>> I am working on d-leveldb wrapper (https://github.com/bheads/d-leveldb)
>> and I need to be able to pass blocks of data between D and leveldb API.
>> I am having rouble getting the byte size of dynamic arrays and POD
>> classes.
>>
>> I can get the right size for 1D dynamic arrays, need a way to compute
>> the total size.
>>
>> POD Classes always give me the size of the ref, is it possible?
>>
>> -Byron
>
>
> __traits(classInstanceSize, MyClass); ?
I missed that one, in my test it returns 29 bytes,
8 for __vptr
8 for __monitor
13 for data
now I am wondering way a POD has a vtable. Either way its not safe to
store a byte copy in to leveldb
More information about the Digitalmars-d-learn
mailing list