FLTK 1.4.0
|
An STL-ish vector without templates. More...
#include <Fl_Int_Vector.H>
Public Member Functions | |
int | back () const |
Return the last element in the array. More... | |
bool | empty () const |
Checks if array has no elements. More... | |
Fl_Int_Vector () | |
Create an empty vector of integers. | |
Fl_Int_Vector (Fl_Int_Vector &o) | |
Copy constructor. | |
Fl_Int_Vector & | operator= (Fl_Int_Vector &o) |
Assignment operator. More... | |
int & | operator[] (int x) |
Access the specified integer element at index position x as a reference. More... | |
int | operator[] (int x) const |
Access the specified integer element at index position x . More... | |
int | pop_back () |
Removes the last element the last element and returns its value. More... | |
void | push_back (int val) |
Appends val to the array, enlarging the array by one. | |
unsigned int | size () const |
Return the number of integer elements in the array. | |
void | size (unsigned int count) |
Set the size of the array to count . More... | |
~Fl_Int_Vector () | |
Destructor - frees the internal array and destroys the class. | |
An STL-ish vector without templates.
Handles dynamic memory management of an integer array, and allows array elements to be accessed with zero based indexing: v[0], v[1]..
Common use:
|
inline |
|
inline |
Checks if array has no elements.
Same as a test for (size() == 0).
|
inline |
Assignment operator.
Similar to the copy constructor, creates a separate copy of the source array, freeing any previous contents in the current integer array.
|
inline |
Access the specified integer element at index position x
as a reference.
This allows assignment by index through the returned reference, e.g. arr[1] = 222; where arr[1] ends up being a reference to ptr[1], and then 222 is assigned to that ref.
x
, which must be less than size().
|
inline |
Access the specified integer element at index position x
.
x
, which must be less than size().
|
inline |
Removes the last element the last element and returns its value.
void Fl_Int_Vector::size | ( | unsigned int | count | ) |
Set the size of the array to count
.
Setting size to zero clears the array and frees any memory it used.
Shrinking truncates the array and frees memory of truncated elements. Enlarging creates new elements that are zero in value.