let's assume I have

class C {
  static string foo() { writeln("got called!"); //.... }
}

then I want to cache foo at some point:

import std.algorithm;
auto v = cache(c.foo);

I call do:

for(int i = 0; i <10; i++) {
writeln(v);
}

then it'll print "got called" only once, which is what I want but something obvious is how do I get the returned value as a string? here's why I'm confused more often than I should: I geeeting to D's way to do thing and the auto keyword even in documentation confused me a bit as I'm used to C++/C# world where the struct/class returned is explicity so I just navigate to aggregate type's documentation page.

Reply via email to