diff options
author | EuAndreh <eu@euandre.org> | 2025-01-22 10:33:21 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2025-01-22 10:33:21 -0300 |
commit | d092ca36e1c5fca9ab8bb6f4fd69aa1e3699e868 (patch) | |
tree | d86acb059602212063656b24f57af630c5cae148 /src/pds.go | |
parent | src/pds.go: Use NewMapBuilder() in implementation of NewMapOf() (diff) | |
download | pds-d092ca36e1c5fca9ab8bb6f4fd69aa1e3699e868.tar.gz pds-d092ca36e1c5fca9ab8bb6f4fd69aa1e3699e868.tar.xz |
src/pds.go: Add NewVectorOf()
Diffstat (limited to '')
-rw-r--r-- | src/pds.go | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -77,6 +77,15 @@ func (l *Vector[T]) clone() *Vector[T] { return &other } +func NewVectorOf[T any](entries []T) *Vector[T] { + v := NewVectorBuilder[T]() + for _, x := range entries { + v.Append(x) + } + + return v.Vector() +} + // Len returns the number of elements in the vector. func (l *Vector[T]) Len() int { return l.size |