Eureka

  • Home
  • About
  • Tags
  • Categories
  • Archives
  • Search
  • Table of Contents
  • Overview
  1. 1. std::allocator
  2. 2. 参考

Luc

129 posts
7 categories
26 tags
GitHub E-Mail

C++ 标准库

Posted on 2024-08-12 Edited on 2025-04-09 In programming Views: Disqus:

std::allocator

1
template< class T > struct allocator;

std::allocator本质上就是 new/delete, 但是为什么需要它呢?

  • 分离 allocation 和 construction(或者分离 deallocation 和 destruction)
  • 主要的使用场景就是在实现container时

参考

  • What’s advantage of using std::allocator instead of new in C++?
# C/C++
多线程中的同步
渲染和送显
© 2025 Luc
Powered by Hexo & NexT.Mist
0%