How to specify the size of a class array ?

I have a class that contains an array. Since there's only 2KB of RAM, I don't want that array to be bigger than what's strictly needed, but I don't want to use dynamic allocation either.
Unless the client code supplies the class constructor a pointer to an already allocated array, the class must declare its array size in advance.
If the class is to be used as a library, a reasonable default size must be specified. If a sketch needs more room, one has to modify the library source. Ugly.

After initialization of the class, will the array grow or not?
Is the max size know at the initialization of the class?
// you could first count the boards, and then initialize the class and add the boards one by one

int _numBoards; ==> uint8_t _numBoards; // 1 byte gained :wink:

what is the range of boardID?

  • does it fit in a byte?
  • can negative values occur?
    ==> uint8_t _boardIds[MAX_BOARD_CNT]; possible? // 50% gained