Tuples citizenship

Don nospam at nospam.com
Fri Mar 2 02:02:10 PST 2012


On 01.03.2012 23:08, bearophile wrote:
> I think std.typecons.Tuples merit to be a little more citizens in D and Phobos.
> I think reducing the usage of "out" argument, and replacing them with a tuple result, will avoid mistakes and make the code look better. In std.math there are functions that maybe are better to use std.typecons.Tuple:
>
> pure nothrow @trusted real frexp(real value, out int exp);
> ==>
> pure nothrow @trusted Tuple!(real, int) frexp(real value);
>
>
> nothrow @trusted real remquo(real x, real y, out int n);
> ==>
> nothrow @trusted Tuple!(real, int) remquo(real x, real y);

They're defined that way because they come from C, and they're in IEEE754.


More information about the Digitalmars-d mailing list