[Issue 9089] Very restrictive Tuple constructor
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Dec 2 09:44:20 PST 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9089
Andrej Mitrovic <andrej.mitrovich at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |andrej.mitrovich at gmail.com
--- Comment #1 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2012-12-02 09:44:19 PST ---
We could change the ctor to:
this(U...)(U values) if (U.length == Types.length)
{
foreach (i, Unused; Types)
{
static if (isNumeric!(Types[i]))
static assert(isNumeric!(U[i]));
field[i] = to!(Types[i])(values[i]);
}
}
(there are 2 ctors but we can use the same approach)
The isNumeric check is necessary because "to" also converts strings to
integrals/floating point. I'm not sure if this would cover all the cases
though.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list