I want to return values of the template parameter type, so there doesn't
seem to be any way to dup or idup them. I don't want the returned
values to be able to be used to modify the values held in the table.
const out is an illegal parameter type. dup doesn't work on ints.
So I tried to ret
On Monday, 2 January 2023 at 22:53:13 UTC, Charles Hixson wrote:
I want to return values of the template parameter type, so
there doesn't seem to be any way to dup or idup them.
It's hard to say where exactly you're going wrong if you only
post the error message, without the code that produced
On 1/2/23 15:14, Paul Backus via Digitalmars-d-learn wrote:
On Monday, 2 January 2023 at 22:53:13 UTC, Charles Hixson wrote:
I want to return values of the template parameter type, so there
doesn't seem to be any way to dup or idup them.
It's hard to say where exactly you're going wrong if y
On 1/2/23 15:14, Paul Backus via Digitalmars-d-learn wrote:
On Monday, 2 January 2023 at 22:53:13 UTC, Charles Hixson wrote:
I want to return values of the template parameter type, so there
doesn't seem to be any way to dup or idup them.
It's hard to say where exactly you're going wrong if y
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:
import std.typecons;
auto func(Key, Value)(Key k, Value
On 1/2/23 17:56, Paul Backus via Digitalmars-d-learn wrote:
return Tuple!(const(Key), const(Value))(k, v);
Great! OK, now the code is:
auto findFirst ()
{ if (root is null)
{ Key k = Key.init;
Val v = Val.init;
return Tuple!(co
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:
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)
{
i