I back up Michel Keijzers' suggestion to use a plain array, especially
given the tiny amount of RAM in your MCU (only 256 bytes).
Concerning the removal of items from the list, and given that your list
will be 16 bytes at most, you don't need to get fancy: just move back
the items that are past the one you removed. It will not take long.
Here is a barebones implementation of a list that can hold at most
16 bytes and supports removal:
class List {
public:
byte length;
byte data[16];
void append(byte item) {
if (length < 16) data[length++] = item;
}
void remove(byte index) {
if (index >= length) return;
memmove(&data[index], &data[index+1], length - index - 1);
length--;
}
};
Note that this only takes 17 bytes of RAM (16 items max plus a
length count). There is not vtable, as it has no virtual methods. You
can get fancier if you want, make this a template parametrized by the
data type and the maximum length, add accessors and such... but if you
are just writing a simple sketch (as opposed to a general purpose
library), I would recommend keeping it as simple as possible.
Example usage, based on your pseudo-code:
List l { .length = 3, .data = { 12, 82, 29 } };
l.remove(1);
This will indeed result in the list [12, 29].