#include #include "stack.h" template std::ostream &operator<<(std::ostream &os, stack &s) { if (!s.empty()) { T t = s.pop(); os << t << ' ' << s; s.push(t); } 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) if (not s.empty()) 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); }