Re: Checking if a structs .init value is zero bits only

2018-03-28 Thread Per Nordlöw via Digitalmars-d-learn
On Wednesday, 28 March 2018 at 01:39:40 UTC, Seb wrote: Have a look at: https://github.com/dlang/phobos/pull/6024 (review/feedbackon this PR is welcome!) Exactly what I wanted. Thanks! In use here https://github.com/nordlow/phobos-next/blob/41b9e0dcfbb4eed6b2ee52d0465425556f14c00f/src/open_

Re: Checking if a structs .init value is zero bits only

2018-03-28 Thread Per Nordlöw via Digitalmars-d-learn
On Wednesday, 28 March 2018 at 00:50:31 UTC, Ali Çehreli wrote: On 03/27/2018 05:15 PM, Per Nordlöw wrote: Is there a way to check if a struct `S` can be initialized using zero bits only, so that we can allocate and initialize an array of `S` in one go using `calloc`? If not, what should such

Re: Checking if a structs .init value is zero bits only

2018-03-27 Thread Seb via Digitalmars-d-learn
On Wednesday, 28 March 2018 at 00:15:34 UTC, Per Nordlöw wrote: Is there a way to check if a struct `S` can be initialized using zero bits only, so that we can allocate and initialize an array of `S` in one go using `calloc`? If not, what should such a trait look like? Have a look at: https:

Re: Checking if a structs .init value is zero bits only

2018-03-27 Thread Ali Çehreli via Digitalmars-d-learn
On 03/27/2018 05:15 PM, Per Nordlöw wrote: Is there a way to check if a struct `S` can be initialized using zero bits only, so that we can allocate and initialize an array of `S` in one go using `calloc`? If not, what should such a trait look like? The following idea should work. One question

Checking if a structs .init value is zero bits only

2018-03-27 Thread Per Nordlöw via Digitalmars-d-learn
Is there a way to check if a struct `S` can be initialized using zero bits only, so that we can allocate and initialize an array of `S` in one go using `calloc`? If not, what should such a trait look like?