// Do calls function f for each element of the vector, in order.
// The behavior of Do is undefined if f changes *p.
-func (p *IntVector) Do(f func(elem interface{})) {
+func (p *IntVector) Do(f func(elem int)) {
for _, e := range *p {
f(e)
}
// Do calls function f for each element of the vector, in order.
// The behavior of Do is undefined if f changes *p.
-func (p *StringVector) Do(f func(elem interface{})) {
+func (p *StringVector) Do(f func(elem string)) {
for _, e := range *p {
f(e)
}
a.Set(i, int2IntValue(salt*i))
}
count := 0
- a.Do(func(e interface{}) {
- i := intf2IntValue(e)
- if i != int2IntValue(count*salt) {
+ a.Do(func(i int) {
+ if i != count*salt {
t.Error(tname(a), "value at", count, "should be", count*salt, "not", i)
}
count++
(*b)[i] = int2IntValue(salt * i)
}
count = 0
- b.Do(func(e interface{}) {
- i := intf2IntValue(e)
- if i != int2IntValue(count*salt) {
+ b.Do(func(i int) {
+ if i != count*salt {
t.Error(tname(b), "b) value at", count, "should be", count*salt, "not", i)
}
count++
c[i] = int2IntValue(salt * i)
}
count = 0
- c.Do(func(e interface{}) {
- i := intf2IntValue(e)
- if i != int2IntValue(count*salt) {
+ c.Do(func(i int) {
+ if i != count*salt {
t.Error(tname(c), "c) value at", count, "should be", count*salt, "not", i)
}
count++
a.Set(i, int2StrValue(salt*i))
}
count := 0
- a.Do(func(e interface{}) {
- i := intf2StrValue(e)
- if i != int2StrValue(count*salt) {
- t.Error(tname(a), "value at", count, "should be", count*salt, "not", i)
+ a.Do(func(s string) {
+ if s != int2StrValue(count*salt) {
+ t.Error(tname(a), "value at", count, "should be", count*salt, "not", s)
}
count++
})
(*b)[i] = int2StrValue(salt * i)
}
count = 0
- b.Do(func(e interface{}) {
- i := intf2StrValue(e)
- if i != int2StrValue(count*salt) {
- t.Error(tname(b), "b) value at", count, "should be", count*salt, "not", i)
+ b.Do(func(s string) {
+ if s != int2StrValue(count*salt) {
+ t.Error(tname(b), "b) value at", count, "should be", count*salt, "not", s)
}
count++
})
c[i] = int2StrValue(salt * i)
}
count = 0
- c.Do(func(e interface{}) {
- i := intf2StrValue(e)
- if i != int2StrValue(count*salt) {
- t.Error(tname(c), "c) value at", count, "should be", count*salt, "not", i)
+ c.Do(func(s string) {
+ if s != int2StrValue(count*salt) {
+ t.Error(tname(c), "c) value at", count, "should be", count*salt, "not", s)
}
count++
})