On Tuesday, 3 January 2023 at 01:56:10 UTC, Paul Backus wrote:
On Monday, 2 January 2023 at 23:25:48 UTC, Charles Hixson wrote:

They syntax I wanted was something like:

bool func (const out Key k, const out Val v) { k = this.key.dup; v = this.val.dup; return true;    }

This works for me:

```d
template Fun(Key, Value)
{
  import std.typecons;

  alias Tup = Tuple!(const(Key), const(Value));

  enum Fun = (Key k, Value v) => Tup(k, v);/*
  auto Fun(Key k, Value v) {
   return Tup(k, v);
  }//*/
}
string k;
uint v;

auto res = Fun(k, v);

static assert(is(typeof(res[0]) == const(string))); // false
static assert(is(typeof(res[1]) == const(uint))); //false
```
I rewrote the code to return the enum. However, static asserts return false. What could this cause?

P.S. Actually the code works when we don't use enum.

SDB@79

Reply via email to