template <typename T, int max_length>
struct fixed_length_list
{
  T values[max_length];
  int length;

  fixed_length_list()
    : length(0)
  {}

  void add(const T& value)
  {
    for (int i = 0; i < length; i++) {
      if (values[i] == value)
        return;
    }

    values[length] = value;
    length += 1;
  }

  void remove(const T& value)
  {
    for (int i = 0; i < length; i++) {
      if (values[i] == value) {
        for (int k = i + 1; k < length;) {
          values[i++] = values[k++];
        }
        length -= 1;
        break;
      }
    }
  }
};
