On Friday, 20 March 2015 at 10:02:27 UTC, Dennis Ritchie wrote:
For example,
lazy int sum(int a = 3, int b = 5) {
return a + b;
}
That is, if the function is not invoked, it should not be
calculated at compile time.
I don't understand what you mean. You mean a function that isn't
compiled if it isn't used anywhere? Template functions that are
only compiled if instantiated, so you could write
int sum()(int a, int b) { return a+b; }
/\
empty braces for a 0-arg template. Can be called just like a
normal function, the only time it would be necessary to
explicitly write sum!() would be if you wanted to take it's
address: &sum!()