This topic has not yet been rated - Rate this topic

unordered_map::allocator_type

The type of an allocator for managing storage.

typedef Alloc allocator_type;

The type is a synonym for the template parameter Alloc.

 

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

Header: <unordered_map>

Namespace: std

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.