다음을 통해 공유


deque::get_allocator

Returns a copy of the allocator object used to construct the deque.

Allocator get_allocator( ) const;

반환 값

The allocator used by the deque.

설명

Allocators for the deque class specify how the class manages storage. The default allocators supplied with STL container classes are sufficient for most programming needs. Writing and using your own allocator class is an advanced C++ topic.

예제

// 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

참고 항목

참조

deque 클래스

표준 템플릿 라이브러리