[Issue 3377] [tdpl] static foreach should be implemented

2015-06-09 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=3377

Andrei Alexandrescu and...@erdani.com changed:

   What|Removed |Added

Version|unspecified |D2

--


[Issue 3377] [tdpl] static foreach should be implemented

2009-11-18 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3377


Walter Bright bugzi...@digitalmars.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||bugzi...@digitalmars.com
 Resolution||WONTFIX


--- Comment #2 from Walter Bright bugzi...@digitalmars.com 2009-11-18 
13:38:27 PST ---
Many problems have come up with the design of this, so will mark as won't
implement until a thorough design is developed.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 3377] [tdpl] static foreach should be implemented

2009-10-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3377


downs default_357-l...@yahoo.de changed:

   What|Removed |Added

 CC||default_357-l...@yahoo.de


--- Comment #1 from downs default_357-l...@yahoo.de 2009-10-08 12:35:53 PDT 
---
This does compile (on 1.0):

template Repeat(T, int I) {
  static if (!I) alias Tuple!() Repeat;
  else alias Tuple!(T, Repeat!(T, I - 1)) Repeat;
}

double unrolledDotProduct(double[] a, double[] b) {
   const branches = 4;
   assert(a.length == b.length);
   double result = 0;
   auto n = (a.length / branches) * branches;
   double temp[branches];
   for (size_t i = 0; i != n; i += branches) {
  foreach (j, BOGUS; Repeat!(void, branches)) {
 temp[j] = a[i + j] * b[i + j];
  }
  result += inline_sum(temp);
   }
   foreach (j; n .. a.length) {
  result += a[j] * b[j];
   }
   return result;
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


Re: [Issue 3377] [tdpl] static foreach should be implemented

2009-10-08 Thread Christopher Wright

d-bugm...@puremagic.com wrote:

http://d.puremagic.com/issues/show_bug.cgi?id=3377


downs default_357-l...@yahoo.de changed:

   What|Removed |Added

 CC||default_357-l...@yahoo.de


--- Comment #1 from downs default_357-l...@yahoo.de 2009-10-08 12:35:53 PDT 
---
This does compile (on 1.0):

template Repeat(T, int I) {
  static if (!I) alias Tuple!() Repeat;
  else alias Tuple!(T, Repeat!(T, I - 1)) Repeat;
}


downs, you are a genius. You can create code that is both elegant and 
dreadful. You make the world a more interesting place.