【发布时间】:2019-11-05 15:56:14
【问题描述】:
在某些情况下,当 i == len(SliceA) 出现切片越界错误。
//filterIntersection removes points from two slices that have common points.
func filterIntersection(sliceA, sliceB *[]ds.Coord) {
for i, a := range *sliceA {
for j, b := range *sliceB {
if a == b {
(*sliceA) = append((*sliceA)[:i], (*sliceA)[i+1:]...) <--- error here
(*sliceB) = append((*sliceB)[:j], (*sliceB)[j+1:]...)
}
}
}
}
【问题讨论】: