Implement a growing insertion.
This commit is contained in:
@@ -95,6 +95,16 @@ void sprs_free(sprs* sprs);
|
||||
* @param data the value to store.
|
||||
*/
|
||||
void sprs_put(sprs* sprs, size_t index, void* data);
|
||||
/**
|
||||
* Stores a value in the sparse set under a given index.
|
||||
* If the capacity of the sparse set is smaller than the given index,
|
||||
* this grows the sparse set by doubling its size.
|
||||
* @param sprs the sparse set into which to store the value.
|
||||
* @param index the index at which to store the value.
|
||||
* @param data the value to store.
|
||||
* @return LIBDS_SUCCESS if all goes well, or LIBDS_MALLOC if the growing failed.
|
||||
*/
|
||||
libds_result sprs_put_grow(sprs* sprs, size_t index, void* data);
|
||||
/**
|
||||
* Checks if the sparse set contains data under a given index.
|
||||
* @param sprs the sparse set to check.
|
||||
|
||||
Reference in New Issue
Block a user