Do pure functions solve the "return const" problems?

Christopher Wright dhasenan at gmail.com
Fri Apr 4 20:57:10 PDT 2008


Janice Caron wrote:
> On 04/04/2008, Christopher Wright <dhasenan at gmail.com> wrote:
>>  Fine, assuming pure arrives after multiple return values.
> 
> Well that's a done deal, since multiple return values arrived a few
> releases back. Witness my prior example, but here's another one:
> 
>     import std.typecons;
> 
>     Tuple!(int,int,int,double) f()
>     {
>         return Tuple!(int,int,int,double)(10, 20, 42, 3.14);
>     }
> 
>     auto t = f();
>     auto x = t._0; // 10
>     auto y = t._1; // 20
>     auto z = t._2; // 42
>     auto g = t._3; // 3.14

Okay, didn't realize that. Still, there shouldn't be any difference 
between out parameters and return values.



More information about the Digitalmars-d mailing list