template expressions in C++ to an equivalent in D

Dominic Jones dominic.jones at qmul.ac.uk
Fri Oct 28 10:18:20 PDT 2011


Hello,

I want to compute, for example
d = a + b + c
where a..d are of some derived type, without incurring the cost of temporaries for each overloaded operation.

In a similar post a while ago, Walter Bright proposed using function literals instead of template expressions to do this. After looking at function literals, I can't work out what he had in mind with this suggestion. May someone present a succinct
complete example to demonstrate how solve this?

Many thanks,
Dominic Jones


More information about the Digitalmars-d-learn mailing list