multimap::get_allocator | public member function |
allocator_type get_allocator() const; |
Get allocator
Returns the allocator object used to constuct the container.
Parameters
noneReturn Value
The allocator.Member type allocator_type is defined to the same as the fourth template parameter used to instantitate this specific multimap class (its Allocator type).
Example
// multimap::get_allocator #include <iostream> #include <map> using namespace std; int main () { int psize; multimap<char,int> mymultimap; pair<const char,int>* p; // allocate an array of 5 elements using mymap's allocator: p=mymultimap.get_allocator().allocate(5); // assign some values to array psize = (int) sizeof(multimap<char,int>::value_type)*5; cout << "The allocated array has a size of " << psize << " bytes.\n"; mymultimap.get_allocator().deallocate(p,5); return 0; } |
A possible output is:
The allocated array has a size of 40 bytes. |
Complexity
Constant.