[计算机科学经

template class t class list public typedef

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 多存在幾個 objects」 static void update_max_live() { if (n_created-n_destroyed > n_max_live) { n_max_live = n_created-n_destroyed; } } public: static long creations() { return n_created; } static long destructions() { return n_destroyed; } static long assignments() { return n_assigned; } static long comparisons() { return n_compared; } static long max_live() { return n_max_live; } public: // 建構式(constructor) SortTracer (int v = 0) : value(v), generation(1) { ++n_created; update_max_live(); std::cerr << "SortTracer #" << n_created << ", created generation " << generation C++ Templates - The Complete Guide 6.6 Templates 的除錯Debugging) 81 << " (total: " << n_created - n_destroyed << ')' << std::endl; } // copy 建構式(copy constructor) SortTracer (SortTracer const& b) : value(b.value), generation(b.generation+1) { ++n_created; update_max_live(); std::cerr << "SortTracer #" << n_created << ", copied as...
View Full Document

This note was uploaded on 08/25/2012 for the course EECS 101 taught by Professor Wre during the Fall '12 term at Beacon FL.

Ask a homework question - tutors are online