Multiple return value as requirements for safety and performance

Daniel Kozák via Digitalmars-d digitalmars-d at puremagic.com
Tue Dec 20 06:54:48 PST 2016


Walter Bright via Digitalmars-d <digitalmars-d at puremagic.com> napsal 
Út, pro 20, 2016 v 3∶47 :
> On 12/20/2016 5:47 AM, Ilya Yaroshenko wrote:
>> One good thing for safety and CTFE is allow multiple return value. In
>> combination with `auto ref` it is _very_ powerful:
>> 
>> ----
>> auto ref front()
>> {
>>   // Returns 2 values, each value is returned by reference if 
>> possible
>>   return (a.front, b.front);
>> }
>> ----
> 
> http://dlang.org/phobos/std_typecons.html#.tuple
> 
> auto ref front() {
>     return tuple(a.front, b.front);
> }

https://github.com/dlang/phobos/blob/master/std/typecons.d#L1686

I do not see any auto ref at code, so I do not belive this will work
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20161220/26cfb38a/attachment.html>


More information about the Digitalmars-d mailing list