Udostępnij za pośrednictwem


list::get_allocator

Zwraca kopię obiektu alokatora używany do utworzenia listy.

Allocator get_allocator( ) const;

Wartość zwracana

Program przydzielania używane przez listę.

Uwagi

Allocators dla klasy list określ, jak klasa zarządza Magazyn.Allocators domyślne dostarczane z klasami STL kontenera są wystarczające dla potrzeb większości programów.Pisanie i przy użyciu klasy alokatora jest temat zaawansowany C++.

Przykład

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

Wymagania

Nagłówek: <list>

Obszar nazw: std

Zobacz też

Informacje

list Class

Standardowa biblioteka szablonu