Although it is more for dynamic memory allocation, I think std::bad_alloc may be the most appropriate, i.e., #include <new> and write:
Code:void Stack::push(char c) { if (top == max_size) throw std::bad_alloc(); }If you are going to use std::stack<char> then you don't need to write your own stack in the first place.Originally Posted by Terrance