digitalmars.D.learn - StoppingPolicy.longest never stop?
- tsukikage (22/22) Jan 29 2011 Why this zip not stop after iterated through the longest range? thanks!
- tsukikage (2/26) Jan 29 2011 note: ￿ is 0xffff (wchar init?) print as "%s"
- bearophile (4/5) Jan 30 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5506
- tsukikage (2/10) Jan 30 2011 Thank you!
Why this zip not stop after iterated through the longest range? thanks! import std.stdio, std.range ; void main() { auto a = [1,2,3,4] ; auto b = [6,7,8,9] ; auto c = "ABCDE" ; // <= longest range here auto d = "ZYXW" ; auto CNT = 0 ; foreach(p; zip(StoppingPolicy.longest, a,b,c, d)) if(CNT++ < 30) writefln("%s %s %s %s", p[0],p[1],p[2], p[3]) ; else break ; } output: 1 6 A Z 2 7 B Y 3 8 C X 4 9 D W 0 0 E ￿ 0 0 ￿ ￿ 0 0 ￿ ￿ <= this continue infinitely if not supply a stopping _CNT_
Jan 29 2011
tsukikage wrote:Why this zip not stop after iterated through the longest range? thanks! import std.stdio, std.range ; void main() { auto a = [1,2,3,4] ; auto b = [6,7,8,9] ; auto c = "ABCDE" ; // <= longest range here auto d = "ZYXW" ; auto CNT = 0 ; foreach(p; zip(StoppingPolicy.longest, a,b,c, d)) if(CNT++ < 30) writefln("%s %s %s %s", p[0],p[1],p[2], p[3]) ; else break ; } output: 1 6 A Z 2 7 B Y 3 8 C X 4 9 D W 0 0 E ￿ 0 0 ￿ ￿ 0 0 ￿ ￿ <= this continue infinitely if not supply a stopping _CNT_note: ￿ is 0xffff (wchar init?) print as "%s"
Jan 29 2011
tsukikage:Why this zip not stop after iterated through the longest range? thanks!http://d.puremagic.com/issues/show_bug.cgi?id=5506 Bye, bearophile
Jan 30 2011
bearophile wrote:tsukikage:Thank you!Why this zip not stop after iterated through the longest range? thanks!http://d.puremagic.com/issues/show_bug.cgi?id=5506 Bye, bearophile
Jan 30 2011