这个分配器如何工作以及我们如何指定分配器? [英] How this allocator works and how we can specify allocator?
本文介绍了这个分配器如何工作以及我们如何指定分配器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
模板<
class T,
class Allocator = std :: allocator< T>
> class vector;
我尝试过:
我在google上搜索过但我没有得到任何具体答案。
解决方案
参见分配器类 [ ^ ]。
请参阅向量 - C ++参考a> [ ^ ]和 vector :: vector - C ++ Reference [ ^ ]。
如果没有提供第二个参数,则默认分配器 - 使用C ++参考a> [ ^ ]。
对于用户定义的分配器,请参阅 C ++标准分配器,简介和实施 [ ^ ]和 C ++概念:分配器 - cppreference .com [ ^ ]。
template< class T, class Allocator = std::allocator<T> > class vector;
What I have tried:
I have searched on google but I have not got any specific answer.
解决方案
See allocator Class[^].
See vector - C++ Reference[^] and vector::vector - C++ Reference[^].
If the second argument is not supplied the default allocator - C++ Reference[^] is used.
For user defined allocators see C++ Standard Allocator, An Introduction and Implementation[^] and C++ concepts: Allocator - cppreference.com[^].
这篇关于这个分配器如何工作以及我们如何指定分配器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文