Collections
PSS has four built-in collection types. They differ in ordering, sizing, and whether they can be randomized.
| Collection | Ordering | Size | Element access | Randomizable |
|---|---|---|---|---|
array |
Ordered by index | Fixed at declaration | [index] |
When the data_type is randomizable |
list |
Ordered by index | Variable | [index] |
rand list needs LRM v2.1; not supported by PSSGen yet |
map |
Unordered, unique keys | Variable | [key] |
No |
set |
Unordered, unique elements | Variable | Not indexable | No |
Operators
| Operator | array |
list |
map |
set |
|---|---|---|---|---|
[] |
||||
= |
||||
== |
||||
!= |
||||
in |
||||
foreach |
The set membership operator in cannot be applied to a map directly; apply it to
the result of keys() or values() instead.
Methods
| Method | array |
list |
map |
set |
|---|---|---|---|---|
size() |
||||
clear() |
||||
delete() |
||||
insert() |
||||
pop_front() / push_front() |
||||
pop_back() / push_back() |
||||
shuffle() |
||||
sum() |
||||
keys() / values() |
||||
to_list() |
||||
to_set() |
Note
Any collection can be nested inside another (for example, a list of arrays),
and its data_type may be any scalar or aggregate type.