Re: Using enforce or assert to check for fullness when appending to fixed length array container

2019-10-04 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, October 4, 2019 4:00:08 AM MDT Per Nordlöw via Digitalmars-d- learn wrote: > I have a wrapper container FixedArray at > > https://github.com/nordlow/phobos-next/blob/25f4a4ee7347427cebd5cd375c9990 > b44108d2ef/src/fixed_array.d > > on top of a static array store that provides the member

Re: Using enforce or assert to check for fullness when appending to fixed length array container

2019-10-04 Thread Tobias Pankrath via Digitalmars-d-learn
On Friday, 4 October 2019 at 10:00:08 UTC, Per Nordlöw wrote: Is the usage of `enforce` to check for out of bounds (fullness) idiomatic D or should an `assert()` be used instead? I'd say it should follow -boundscheck: https://dlang.org/dmd-linux.html#switch-boundscheck Does that set an

Using enforce or assert to check for fullness when appending to fixed length array container

2019-10-04 Thread Per Nordlöw via Digitalmars-d-learn
I have a wrapper container FixedArray at https://github.com/nordlow/phobos-next/blob/25f4a4ee7347427cebd5cd375c9990b44108d2ef/src/fixed_array.d on top of a static array store that provides the member void insertBack(Es...)(Es es) @trusted if (Es.length <= capacity) // TODO use