Bad array indexing is considered deadly
Moritz Maxeiner via Digitalmars-d
digitalmars-d at puremagic.com
Sat Jun 3 16:41:50 PDT 2017
On Wednesday, 31 May 2017 at 21:00:43 UTC, Steven Schveighoffer
wrote:
>
> That is my conclusion too. Is your library in a usable state?
> Perhaps we should not repeat efforts, though I wasn't planning
> on making a robust public library for it :)
After some consideration you can now find the (dynamic) array
implementation here[1].
With regards to (usage) errors: The data structures in libds
allow passing an optional function `attest` via the template
parameter `Hook` (DbI). `attest` is passed the data structure (by
ref, for logging purposes) and a boolean value and must only
return successfully if the value is true; if it is false,
`attest` must throw something (e.g. an Exception), or terminate
the process.
An example of how to use it is here[2].
If no `attest` is passed, the data structures default to throwing
an AssertError.
[1]
https://github.com/Calrama/libds/blob/fbceda333dbf76697050faeb6e25dbfcc9e3fbc0/src/ds/linear/array/dynamic.d
[2]
https://github.com/Calrama/libds/blob/fbceda333dbf76697050faeb6e25dbfcc9e3fbc0/src/ds/tree/heap/binary.d#L381
More information about the Digitalmars-d
mailing list