summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Fl_Int_Vector.cxx16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/Fl_Int_Vector.cxx b/src/Fl_Int_Vector.cxx
index 361dd2634..08e45c4cc 100644
--- a/src/Fl_Int_Vector.cxx
+++ b/src/Fl_Int_Vector.cxx
@@ -18,16 +18,32 @@
#include <FL/Fl_Int_Vector.H>
#include <stdlib.h>
+/**
+ Make a copy of another array.
+ Private: For use internally by the class's copy ctors only.
+*/
void Fl_Int_Vector::copy(int *newarr, unsigned int newsize) {
size(newsize);
memcpy(arr_, newarr, newsize * sizeof(int));
}
+/** Destructor - frees the internal array and destroys the class. */
Fl_Int_Vector::~Fl_Int_Vector() {
if (arr_)
free(arr_);
}
+/**
+ Set the size of the array to \p count.
+
+ A size of zero empties the array completely and frees all memory.
+
+ \warning
+ - Only advised use currently is to shrink the array size, i.e. (count < size()).
+ - Currently enlarging the array leaves the new values uninitialized.
+ - When assignment via indexes is supported, i.e. v[x] = 123, array enlargement should zero new values
+ \todo Check if count > size, and if so init new values to 0.
+*/
void Fl_Int_Vector::size(unsigned int count) {
if (count <= 0) {
if (arr_)