On Wednesday, 24 February 2021 at 03:57:37 UTC, Adam D. Ruppe wrote:
On Wednesday, 24 February 2021 at 03:52:57 UTC, Kyle Ingraham wrote:
The part that got my attention was `bool isBGR`. I was under the impression that compile-time or template parameters were only for types.

No, you can pass almost anything to them.

https://dlang.org/spec/template.html#template_value_parameter

Much appreciated. This is exactly what I wanted to take a look at.

and other surrounding sections

Why would one write a function this way?

To specialize on information known at compile time. It will also call functions as-needed to get that value all at compile time.

That brings it all together. Types aren't the only thing one would want to use to specialize. Thank you for the explanation. I'm making my way in from interpreted languages so templates are a still unfamiliar way to solve problems.

Reply via email to