mirror of
https://github.com/bkthomps/Containers.git
synced 2025-11-16 04:24:47 +00:00
Improve documentation (#50)
Further improve the documentation to prevent any possible confusion.
This commit is contained in:
17
src/array.c
17
src/array.c
@@ -81,7 +81,9 @@ int array_size(array me)
|
||||
* Copies the array to a raw array. Since it is a copy, the raw array may be
|
||||
* modified without causing side effects to the array data structure. Memory
|
||||
* is not allocated, thus the raw array being used for the copy must be
|
||||
* allocated before this function is called.
|
||||
* allocated before this function is called. The size of the array should be
|
||||
* queried prior to calling this function, which also serves as the size of the
|
||||
* newly-copied raw array.
|
||||
*
|
||||
* @param arr the initialized raw array to copy the array to
|
||||
* @param me the array to copy to the raw array
|
||||
@@ -95,10 +97,15 @@ void array_copy_to_array(void *const arr, array me)
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the storage element of the array structure. This pointer is not a copy,
|
||||
* thus any modification to the data will cause the array structure data to be
|
||||
* modified. Operations using the array functions may invalidate this pointer.
|
||||
* The array owns this memory, thus it should not be freed.
|
||||
* Gets the storage element of the array structure. The storage element is
|
||||
* contiguous in memory. The data pointer should be assigned to the correct
|
||||
* array type. For example, if the array holds integers, the data pointer should
|
||||
* be assigned to a raw integer array. The size of the array should be obtained
|
||||
* prior to calling this function, which also serves as the size of the queried
|
||||
* raw array. This pointer is not a copy, thus any modification to the data will
|
||||
* cause the array structure data to be modified. Operations using the array
|
||||
* functions may invalidate this pointer. The array owns this memory, thus it
|
||||
* should not be freed.
|
||||
*
|
||||
* @param me the array to get the storage element from
|
||||
*
|
||||
|
||||
@@ -150,7 +150,9 @@ int deque_trim(deque me)
|
||||
* Copies the deque to an array. Since it is a copy, the array may be modified
|
||||
* without causing side effects to the deque data structure. Memory is not
|
||||
* allocated, thus the array being used for the copy must be allocated before
|
||||
* this function is called.
|
||||
* this function is called. The size of the deque should be queried prior to
|
||||
* calling this function, which also serves as the size of the newly-copied
|
||||
* array.
|
||||
*
|
||||
* @param arr the initialized array to copy the deque to
|
||||
* @param me the deque to copy to the array
|
||||
|
||||
@@ -88,7 +88,9 @@ int forward_list_is_empty(forward_list me)
|
||||
* Copies the nodes of the singly-linked list to an array. Since it is a copy,
|
||||
* the array may be modified without causing side effects to the singly-linked
|
||||
* list data structure. Memory is not allocated, thus the array being used for
|
||||
* the copy must be allocated before this function is called.
|
||||
* the copy must be allocated before this function is called. The size of the
|
||||
* singly-linked list should be queried prior to calling this function, which
|
||||
* also serves as the size of the newly-copied array.
|
||||
*
|
||||
* @param arr the initialized array to copy the singly-linked list to
|
||||
* @param me the singly-linked list to copy to the array
|
||||
|
||||
@@ -88,10 +88,12 @@ int list_is_empty(list me)
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies the nodes of the doubly-linked list to an array.Since it is a copy,
|
||||
* Copies the nodes of the doubly-linked list to an array. Since it is a copy,
|
||||
* the array may be modified without causing side effects to the doubly-linked
|
||||
* list data structure. Memory is not allocated, thus the array being used for
|
||||
* the copy must be allocated before this function is called.
|
||||
* the copy must be allocated before this function is called. The size of the
|
||||
* doubly-linked list should be queried prior to calling this function, which
|
||||
* also serves as the size of the newly-copied array.
|
||||
*
|
||||
* @param arr the initialized array to copy the doubly-linked list to
|
||||
* @param me the doubly-linked list to copy to the array
|
||||
|
||||
@@ -346,7 +346,7 @@ void unordered_multimap_get_start(unordered_multimap me, void *const key)
|
||||
/**
|
||||
* Iterates over the values for the specified key. Must be called after starting
|
||||
* the iterator. The unordered multi-map must not be mutated between start and
|
||||
* iterations.The pointer to the value being obtained should point to the value
|
||||
* iterations. The pointer to the value being obtained should point to the value
|
||||
* type which this unordered multi-map holds. For example, if this unordered
|
||||
* multi-map holds value integers, the value pointer should be a pointer to an
|
||||
* integer. Since the value is being copied, the pointer only has to be valid
|
||||
|
||||
18
src/vector.c
18
src/vector.c
@@ -150,7 +150,9 @@ int vector_trim(vector me)
|
||||
* Copies the vector to an array. Since it is a copy, the array may be modified
|
||||
* without causing side effects to the vector data structure. Memory is not
|
||||
* allocated, thus the array being used for the copy must be allocated before
|
||||
* this function is called.
|
||||
* this function is called. The size of the vector should be queried prior to
|
||||
* calling this function, which also serves as the size of the newly-copied
|
||||
* array.
|
||||
*
|
||||
* @param arr the initialized array to copy the vector to
|
||||
* @param me the vector to copy to the array
|
||||
@@ -161,11 +163,15 @@ void vector_copy_to_array(void *const arr, vector me)
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the storage element of the vector which is contiguous in memory. This
|
||||
* pointer is not a copy, thus any modification to the data will cause the
|
||||
* vector structure data to be modified. Operations using the vector functions
|
||||
* may invalidate this pointer. The vector owns this memory, thus it should not
|
||||
* be freed.
|
||||
* Gets the storage element of the vector structure. The storage element is
|
||||
* contiguous in memory. The data pointer should be assigned to the correct
|
||||
* array type. For example, if the vector holds integers, the data pointer
|
||||
* should be assigned to an integer array. The size of the vector should be
|
||||
* obtained prior to calling this function, which also serves as the size of
|
||||
* the queried array. This pointer is not a copy, thus any modification to the
|
||||
* data will cause the vector structure data to be modified. Operations using
|
||||
* the vector functions may invalidate this pointer. The vector owns this
|
||||
* memory, thus it should not be freed.
|
||||
*
|
||||
* @param me the vector to get the storage element from
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user