mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
improve slice copying
This commit is contained in:
parent
b99c01a03f
commit
ca71c81284
|
@ -38,8 +38,9 @@ func (slice PriceVolumeSlice) Trim() (pvs PriceVolumeSlice) {
|
|||
}
|
||||
|
||||
func (slice PriceVolumeSlice) Copy() PriceVolumeSlice {
|
||||
// this is faster than make (however it's only for simple types)
|
||||
return append(slice[:0:0], slice...)
|
||||
var s = make(PriceVolumeSlice, len(slice), len(slice))
|
||||
copy(s, slice)
|
||||
return s
|
||||
}
|
||||
|
||||
func (slice PriceVolumeSlice) First() (PriceVolume, bool) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user