On Wednesday, 30 November 2022 at 01:30:03 UTC, Steven Schveighoffer wrote:
On 11/29/22 7:50 PM, WebFreak001 wrote:

(note: I don't want to use a template, this way of writing it has the advantage that the compiler checks all different code paths for errors, so the errors aren't delayed until someone actually tries to iterate over my data structure)

1. use the template
2. use a unittest to prove they all compile.

+1. I use this pattern often:

https://github.com/CyberShadow/ae/blob/86b016fd258ebc26f0da3239a6332c4ebecd3215/utils/graphics/libpng.d#L716-L721

https://github.com/CyberShadow/ae/blob/86b016fd258ebc26f0da3239a6332c4ebecd3215/utils/math/combinatorics.d#L220-L222

Reply via email to