d - transform each element of tuple; get that tuple -


i have tuple in d. want apply element-wise operation on tuple, , transformed tuple passing function accepts variadic template arguments. execution path of transform defined @ compile time, actual value not.

the purpose of similar template mechanism used in c++'s bind construct, determining use placeholders/passed arguments , use stored arguments @ compile time.

how accomplish this?

this first time in d i've ever missed feature in c++11's template system: pack/unpack operator - please make me not feel bad :-(

edit: ended using mixins, because apparently generic programming solution want can solved using them. may answer them if no 1 comes more elegant taking d's ridiculously powerful jackhammer-of-a-generic-programming-tool it.

the element of tuple can template alias parameter can be. however, run-time expressions cannot alias parameters - evaluated @ compile time. thus, not possible transform tuple using transformation runs @ compile-time (barring workarounds such transformation defines @property function returns result).

if expression , transformation can evaluated @ compile-time, see staticmap std.typetuple.


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -