uestla / Sparse-Matrix

C++ implementation of sparse matrix using CRS (Compressed Row Storage) format

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SparseMatrix::get() should return NULL if value not set

uestla opened this issue · comments

Since the matrix item can be any type, the getter should return NULL instead of zero when item not set yet (+ update README as well).

Also setter should remove value if first parameter is NULL (not zero).

This will mean that getter should return pointer to item type T (and NULL if not set).

New method unset() will be needed since zero will not be considered in setter.

Default value/allocator should also not be passed when creating vector with values or operation result.

After all I changed it from pointers to creating empty element (reduces vulnerability to cause memory leaks).