Extend the call site default argument expansion mechanism?
jmh530
john.michael.hall at gmail.com
Wed May 16 10:51:51 UTC 2018
On Wednesday, 16 May 2018 at 09:01:29 UTC, Simen Kjærås wrote:
> snip]
>
> struct Foo(int x)
> {
> int n = x;
> auto opDispatch(string s)()
> if (s == "bar")
> {
> n++;
> return n;
> }
> }
>
>
> unittest
> {
> int y = 0;
> with(Foo!1())
> {
> y = bar; // Works!
> }
> assert(y == 2);
> }
>
> --
> Simen
Thanks for catching that. Any idea why the original was having
problems?
More information about the Digitalmars-d
mailing list