The intList class provides a list of integer numbers. More...
| intList( ) | |
| intList( intList list ) | |
| void | append(int value) |
| int | at(int pos) |
| void | clear() |
| bool | contains(int value) |
| void | insert(int pos, int value) |
| int | indexOf(int value, int index=0) |
| void | prepend(int value) |
| int | removeAll(int value) |
| void | removeAt(int pos) |
| int | size() |
| void | set(int pos, int value) |
| void | swap(int pos1, int pos2) |
A intList is a dynamic list of integers. file readBinary fills one int per byte; writeBinary writes that list back. setup getNetlistNotUseDatatype also returns one. In C++ macros this type is the same as an integer array, so you can use both a[i] and a.at(i). Index 0 is the first entry; size is the count; set does nothing if pos is past the end. append, insert, prepend, and removeAt change the length. contains and indexOf search. In Python this maps to a native list of integers.
Example:
intList list;
list.append(1);
list.append(32);
list.append(67);
if (list.contains(32)) {
int v = list.at(1);
list.set(0, v);
}
Creates an empty list of integers.
Creates a list of integers with copied data from list.
Inserts value at the end of the list.
Returns: the integer at index pos. The first entry is 0.
Removes all items from the list. (introduced with release 20230121)
Returns: true if the list contains value, otherwise false.
Inserts value at pos. Later entries move one position.
Returns: the index of the first occurrence of value, searching forward from index. Returns -1 if value is not found.
Inserts value at the beginning of the list. (introduced with release 20260714)
Removes every occurrence of value.
Returns: the number of entries removed.
Removes the entry at pos. The list shrinks by one.
Returns: the number of integers in the list.
Sets entry pos to value. The first entry is 0. Has no effect if the list is shorter than pos.
Swaps the values at pos1 and pos2.