I*******e 发帖数: 1879 | 1 ☆─────────────────────────────────────☆
st09 (st09) 于 (Tue Jun 9 22:11:14 2009, 美东) 提到:
做了一道笔试题,下面是和我的答案如下,请点评一下.
There are situations when a program frequently allocates variables of the
same type from the heap and deletes them after processing. To avoid costly
memory allocation, design and implement a class that returns chunks of
memory of the size of the variable and accepts those chunks of memory back
for further reuse.
Example:
class MemPool
{
…
public:
void |
|