0
点赞
收藏
分享

微信扫一扫

软件行业与就业(导师主讲)

8052cf60ff5c 2023-10-10 阅读 31

文章目录

一、设计内存池

在上节中,我们在模板链表栈中使用了默认构造器来管理栈操作中的元素内存,一共涉及到了 rebind::other, allocate(), dealocate(), construct(), destroy()这些关键性的接口。所以为了让代码直接可用,我们同样应该在内存池中设计同样的接口:

#ifndef MEMORY_POOL_HPP
#define MEMORY_POOL_HPP

#include <climits>
#include <cstddef>

template <typename T, size
举报

相关推荐

0 条评论