diff options
Diffstat (limited to 'src/lib/container/vector.go')
-rw-r--r-- | src/lib/container/vector.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/lib/container/vector.go b/src/lib/container/vector.go index 07c7d3df0..392e5e596 100644 --- a/src/lib/container/vector.go +++ b/src/lib/container/vector.go @@ -107,6 +107,16 @@ func (p *Vector) Last() Element { } +// Data returns all the elements as a slice. +func (p *Vector) Data() []Element { + arr := make([]Element, p.Len()); + for i, v := range p.a { + arr[i] = v + } + return arr +} + + // Insert inserts into the vector an element of value x before // the current element at index i. func (p *Vector) Insert(i int, x Element) { |