This code works;
int at(int index) { if(index < 1 || index >= size) throw 0; return x[index]; }
Yet this doesn\'t
Replace throw std::out_of_range; with throw std::out_of_range ("blah");. I.e. you need to create an object, you cannot throw a type.
throw std::out_of_range;
throw std::out_of_range ("blah");