- map[meta header]
- std[meta namespace]
- multimap[meta class]
- function[meta id-type]
allocator_type get_allocator() const; // (1) C++03
allocator_type get_allocator() const noexcept; // (1) C++11
constexpr allocator_type get_allocator() const noexcept; // (1) C++26コンテナの構築に使われたアロケータオブジェクトを返す。
アロケータオブジェクト。
メンバ型 allocator_type は、multimap クラスがインスタンス化されるのに使われる 4 番目のテンプレートパラメータ(Allocator 型)と同じ型として定義される。
投げない
定数時間
#include <iostream>
#include <map>
int main()
{
std::multimap<int, char> m;
std::pair<const int, char>* p = m.get_allocator().allocate(2);
p[0].second = 'a';
p[1].second = 'b';
std::cout << p[0].second << std::endl;
std::cout << p[1].second << std::endl;
m.get_allocator().deallocate(p, 2);
return 0;
}- get_allocator()[color ff0000]
- allocate[link /reference/memory/allocator/allocate.md]
- deallocate[link /reference/memory/allocator/deallocate.md]
a
b
- C++03
- C++11
- Clang: ??
- GCC: ??
- ICC: ??
- Visual C++: 2002 [mark verified], 2003 [mark verified], 2005 [mark verified], 2008 [mark verified], 2010 [mark verified], 2012 [mark verified], 2013 [mark verified], 2015 [mark verified], 2017 [mark verified]
- 2012, 2013は、
noexceptが実装されていないため、throw()が修飾されている。 - 2015からは、
noexceptが修飾されている。
- 2012, 2013は、