How should I return multiple const values from a function?

Charles Hixson charleshixsn at earthlink.net
Tue Jan 3 04:01:17 UTC 2023


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!(const(Key), const(Val))(k, v);
         }
         Node    n    =    root;
         while (n.lft !is null)    n    =    n.lft;
         auto k    =    cast(const)(n.key);
         auto v    =    cast(const)(n.val);
         return Tuple!(const(Key), const(Val))(k, v);
     }    //nd    bool    findFirst (out Key k, out Val v)
I couldn't show that previously because the various things I was trying 
were too different.

-- 
Javascript is what you use to allow third part programs you don't know anything about and doing you know not what to run on your computer.



More information about the Digitalmars-d-learn mailing list