2 ms·
In C++ you can pass a no-arguments lambda with local bindings that approximates pass-by-name. If actually evaluating the expression is something expensive and
by ncmncm 6y ago
In C++ you can pass a no-arguments lambda with local bindings that approximates pass-by-name.
If actually evaluating the expression is something expensive and its result might not be needed, it can be the right thing. But whoever designs the function interface has to anticipate that possibility.