Tuple opAssign type deduction

ketmar via Digitalmars-d digitalmars-d at puremagic.com
Tue Dec 23 16:52:58 PST 2014


On Wed, 24 Dec 2014 00:16:33 +0000
aldanor via Digitalmars-d <digitalmars-d at puremagic.com> wrote:

> alias T = Tuple!(int, "a", double, "b");
> T foo = [1, 2]; // works
> T bar;
> bar = [1, 2]; // doesn't?
> 
> Wonder if there's an obvious reason to this?
as for "why it's not working"... i honestly don't know. adding simple
`opAssign` overload to Tuple struct solves it:

  void opAssign(U, size_t n)(U[n] values)
  if (n == Types.length && allSatisfy!(isBuildableFrom!U, Types))
  {
      foreach (i, _; Types)
      {
          field[i] = values[i];
      }
  }

i guess that this was simply overlooked, so i think that you can create
ER for this.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20141224/00a8ca7c/attachment.sig>


More information about the Digitalmars-d mailing list