Quick help on version function parameter
Jonathan Marler via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Feb 18 17:39:18 PST 2015
On Wednesday, 18 February 2015 at 23:49:26 UTC, Adam D. Ruppe
wrote:
> I'd write a foo_impl which always takes a parameter. Then do
> the versioned foo() functions which just forward to it:
>
> void foo_impl(int x) { long function using x here }
>
> version(globals) {
> int x;
> void foo() {
> foo_impl(x);
> }
> } else {
> void foo(int x) { foo_impl(x); }
> }
>
> Minimal duplication with both interfaces.
That kinda defeats the purpose of why I want this. It's for
performance reasons. I need one version to have NO arguments and
one version to have one ref argument.
More information about the Digitalmars-d-learn
mailing list