Skip to content

utils/vector: Slice() method is broken #492

@gucio321

Description

@gucio321
// Slice converts a Vector to a slice []T.
func (v Vector[T]) Slice() []T {
        // We consider v.Data a pointer to 1st element of a slice []T
        // of size v.Size and capacity v.Capacity
        return unsafe.Slice(v.Data, v.Size)
}

The problem is, that in most Vector implementations T is supposed to be a pointer to the Go-wrapped type, so converting it to the C slice makes no sense (and causes issues).

this should either refer to v.Data.CData or make T a C type pointer (need to design this somehow)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions