ASL
|
This class represents a fixed-length array.
It is similar to Array but the array length is fixed and must be known at compile time. It is much faster to create and copy than a dynamic Array.
#include <Array_.h>
Public Member Functions | |
int | length () const |
Returns the number of elements in the array. | |
operator const T * () const | |
Returns a pointer to the base of the array. | |
bool | operator== (const Array_ &b) const |
Tests for equality of all elements of both arrays. | |
const T & | operator[] (int i) const |
Returns the element at index i. | |
T & | operator[] (int i) |
Returns the element at index i. | |
const T & | last () const |
Returns a reference to the last element. | |
T & | last () |
Returns a reference to the last element. | |
int | indexOf (const T &x, int j=0) const |
Returns the index of the first element with value x. More... | |
bool | contains (const T &x) const |
Returns true if the array contains an element equal to x. | |
Array_ & | operator= (const Array_ &b) |
Assigns array b into this array by reference. | |
Array_ & | sort () |
Sorts the array using the elements' < operator "in place". | |
template<class Less > | |
Array_ & | sort (Less f) |
Sorts the array using the elements' < operator "in place". | |
String | join (const String &sep) const |
Returns a string representation of the array, formed by joining its elements with the given separator string sep. More... | |
|
inline |
Returns the index of the first element with value x.
The search starts at position j. The value -1 is returned if no such element is found
Returns a string representation of the array, formed by joining its elements with the given separator string sep.
The elements need to be convertible to String