Re: Getting byte size of POD classes and dynamic arrays

2013-05-16 Thread Andrej Mitrovic
On 5/16/13, Byron Heads wrote: > On Thu, 16 May 2013 08:11:35 -0500, 1100110 wrote: >> >> __traits(classInstanceSize, MyClass); ? > > Any ideas on how to get the element type of an array > ie: int[] -> int int[][] -> int[] Try the ElementType template in std.range. There's also ElementEncod

Re: Getting byte size of POD classes and dynamic arrays

2013-05-16 Thread bearophile
Byron Heads: Not the most initiative name for the function but works for my case.< It has a strange name because a string (that is a dynamic array) iterated as range (like by map()) has a type different from the same iterated on default with foreach... Bye, bearophile

Re: Getting byte size of POD classes and dynamic arrays

2013-05-16 Thread Byron Heads
On Thu, 16 May 2013 13:49:51 +, Byron Heads wrote: > On Thu, 16 May 2013 08:11:35 -0500, 1100110 wrote: >> >> __traits(classInstanceSize, MyClass); ? > > Any ideas on how to get the element type of an array ie: int[] -> int > int[][] -> int[] > > I am going to block dynamic arrays wit

Re: Getting byte size of POD classes and dynamic arrays

2013-05-16 Thread Byron Heads
On Thu, 16 May 2013 08:11:35 -0500, 1100110 wrote: > > __traits(classInstanceSize, MyClass); ? Any ideas on how to get the element type of an array ie: int[] -> int int[][] -> int[] I am going to block dynamic arrays with more then 1D, since they are holding pointers in the data block

Re: Getting byte size of POD classes and dynamic arrays

2013-05-16 Thread Byron Heads
On Thu, 16 May 2013 15:32:35 +0200, bearophile wrote: > Byron Heads: > >> now I am wondering way a POD has a vtable. > > In D global structs are PODs, while classe instances are are not PODs. > > All classes have a vtable because they inherit some methods from the > Object class. > > Bye, > be

Re: Getting byte size of POD classes and dynamic arrays

2013-05-16 Thread 1100110
On 05/16/2013 08:21 AM, Byron Heads wrote: > 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. >>

Re: Getting byte size of POD classes and dynamic arrays

2013-05-16 Thread bearophile
Byron Heads: now I am wondering way a POD has a vtable. In D global structs are PODs, while classe instances are are not PODs. All classes have a vtable because they inherit some methods from the Object class. Bye, bearophile

Re: Getting byte size of POD classes and dynamic arrays

2013-05-16 Thread Byron Heads
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 dynam

Re: Getting byte size of POD classes and dynamic arrays

2013-05-16 Thread 1100110
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 s

Getting byte size of POD classes and dynamic arrays

2013-05-16 Thread Byron Heads
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 t