1
0
mirror of https://github.com/golang/go synced 2024-11-26 04:27:58 -07:00

use range in vector iterator

R=rsc
DELTA=2  (0 added, 0 deleted, 2 changed)
OCL=27003
CL=27003
This commit is contained in:
Rob Pike 2009-04-01 16:34:25 -07:00
parent 6d5bba5148
commit 62d11a3302

View File

@ -214,8 +214,8 @@ func (p *Vector) Swap(i, j int) {
// Iterate over all elements; driver for range
func (p *Vector) iterate(c chan Element) {
for i := 0; i < len(p.a); i++ {
c <- p.a[i]
for i, v := range p.a {
c <- v
}
close(c);
}