mirror of
https://github.com/golang/go
synced 2024-11-26 04:17:59 -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:
parent
6d5bba5148
commit
62d11a3302
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user