다음을 통해 공유


list::get_allocator

목록을 만드는 데 사용 되는 할당 기 개체의 복사본을 반환 합니다.

Allocator get_allocator( ) const;

반환 값

목록에서 사용할 할당자입니다.

설명

List 클래스의 할당자 클래스 저장소를 관리 하는 방법을 지정 합니다.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

참고 항목

참조

list Class

표준 템플릿 라이브러리