Compile-Time Function Parameters That Aren't Types?
Kyle Ingraham
kyle at kyleingraham.com
Wed Feb 24 03:52:57 UTC 2021
I was reading the code for the DCV library and came across this
function:
https://github.com/libmir/dcv/blob/master/source/dcv/imgproc/color.d#L128
Here is a shortened form:
[return type] rgbbgr2gray(bool isBGR, V)([run-time
parameters]){[implementation]}
and an example call:
rgbbgr2gray!(true, [a type])([run-time arguments])
The part that got my attention was `bool isBGR`. I was under the
impression that compile-time or template parameters were only for
types. Where would one find information on this in the D spec?
Why would one write a function this way?
More information about the Digitalmars-d-learn
mailing list