返回用于的分配器对象的复制构造列表。
Allocator get_allocator( ) const;
返回值
列出了使用的分配器。
备注
列表选件类的分配器指定选件类如何管理存储。默认分配程序提供了STL容器选件类对于大多数编程的需要就足够了。编写和使用您的分配器选件类是高级C++主题。
示例
// list_get_allocator.cpp
// compile with: /EHsc
#include <list>
#include <iostream>
int main( ) 
{
   using namespace std;
   // The following lines declare objects 
   // that use the default allocator.
   list <int> c1;
   list <int, allocator<int> > c2 = list <int, allocator<int> >( allocator<int>( ) );
   // c3 will use the same allocator class as c1
   list <int> c3( c1.get_allocator( ) );
   list<int>::allocator_type xlst = c1.get_allocator( );
   // You can now call functions on the allocator class used by c1
}
要求
标头: <list>
命名空间: std