Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.
We recommend using Visual Studio 2017

unordered_map::get_allocator

 

Gets the stored allocator object.

Alloc get_allocator() const;

The member function returns the stored allocator object.

Example

 

// std_tr1__unordered_map__unordered_map_get_allocator.cpp 
// compile with: /EHsc 
#include <unordered_map> 
#include <iostream> 

typedef std::unordered_map<char, int> Mymap; 
typedef std::allocator<std::pair<const char, int> > Myalloc; 
int main() 
    { 
    Mymap c1; 

    Mymap::allocator_type al = c1.get_allocator(); 
    std::cout << "al == std::allocator() is " 
        << std::boolalpha << (al == Myalloc()) << std::endl; 

    return (0); 
    } 

al == std::allocator() is true

Requirements

Header: <unordered_map>

Namespace: std

Show: