#include #include #include "stack.h" template std::ostream &operator<<(std::ostream &os, stack &s) { auto o = s.pop(); if (o) { os << *o << ' ' << s; s.push(*o); } return os; } template void push(stack &s, size_t n) { for (size_t i = 0; i < n; ++i) s.push(i); } template void pop(stack &s, size_t n) { for (size_t i = 0; i < n; ++i) s.pop(); } int main(int argc, char **argv) { const size_t N = 1000, S = 10; stack s; std::cout << "s = " << s << std::endl; push(s, S); std::cout << "s = " << s << std::endl; pop(s, S * S); std::cout << "s = " << s << std::endl; push(s, N); pop(s, N * N); push(s, N); // fill stack to test destructor... }