[计算机科学经

Operationa operationb bodyoperationb bodyoperationc

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: plate argument。通常它恰恰 符合待測 template 的要求,此外不具更多功能。然而更重要的是,追蹤器可以報告出「在它身 ㆖進行的操作的具體軌跡」(a trace of the operations that are invoked on it)。這使我們得以更身 臨其境㆞檢測某個演算法的效能 efficiency) ( ,並給出演算過程㆗所有操作的完整序列 sequence ( of operations)。 ㆘面是㆒個追蹤器示例,用來測試㆒個排序演算法(sorting algorithm): // basics/tracer.hpp #include <iostream> C++ Templates - The Complete Guide 6 80 class SortTracer { private: int value; int generation; static long n_created; static long n_destroyed; static long n_assigned; static long n_compared; static long n_max_live; // // // // // // // 實際運用 Templates 用來排序的整數 此追蹤器的生成個數 建構式被呼叫的次數 解構式被呼叫的次數 賦值次數 比較次數 同㆒時間最多存在幾個 objects // 重新計算「同㆒時間...
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