On 1/13/23 07:22, Gavin Ray wrote:
> Maybe it would be better to wrap the slice in a new class with an
> invariant?
Possibly but please check before using because I think 'invariant'
requires presence of member functions:
https://dlang.org/spec/struct.html#Invariant
> Because what I want to do is:
>
> 1. Ensure that the length of the underlying referenced/pointed-to data
> is `PAGE_SIZE`
My first thought was why not use a slice anyway?
Worth noting that static arrays are value types. Also, they all have
different types from each other and have the potential to cause template
bloat.
> class BufferPool
Off-topic, most D programmers use struct unless they need class.
> Frame[BUF_POOL_NUM_PAGES] frames;
Makes sense to me.
Ali