deque::get_allocator
傳回用來配置器物件的複本建構 deque。
Allocator get_allocator( ) const;
傳回值
deque 使用的配置器。
備註
deque 類別的配置器指定類別如何處理儲存區。預設配置器提供 STL 容器類別適用於大部分的程式設計需求是否足夠。擁有配置器類別的撰寫和使用為進階 C++ 的主題。
範例
// deque_get_allocator.cpp
// compile with: /EHsc
#include <deque>
#include <iostream>
int main( )
{
using namespace std;
// The following lines declare objects that use the default allocator.
deque <int> c1;
deque <int, allocator<int> > c2 = deque <int, allocator<int> >( allocator<int>( ) );
// c3 will use the same allocator class as c1
deque <int> c3( c1.get_allocator( ) );
deque <int>::allocator_type xlst = c1.get_allocator( );
// You can now call functions on the allocator class used by c1
}
需求
標題: <deque>
命名空間: std