On Tuesday, 3 January 2023 at 07:41:46 UTC, Salih Dincer wrote:
P.S. Actually the code works when we don't use enum.
My mistake, I forgot that enum cannot be inferred!
Very very sorry, suppose I didn't intervene 😀 Also this has
worked:
```d
void main() {
template Fun(Key, Value)
{
import std.typecons;
alias Tup = Tuple!(const(Key), const(Value));
enum Fun = (Key k, Value v) => Tup(k, v);
}
string k;
uint v;
auto res = Fun!(string, uint)(k, v);
assert(
is(typeof(res[0]) == const(string)) &&
is(typeof(res[1]) == const(uint))
);
}
```
SDB@79