You're getting an exception because of a stack overflow. This is because of how by first calling the function push, the function will then proceed to recursively call itself over and over because of line 28. To which, the function will never return and voila a stack overflow. Also as a side note, you shouldn't be inheriting from stdlib containers because of how they weren't made to be inherited from(no virtual destructor).