- string[meta header]
- std[meta namespace]
- basic_string[meta class]
- function[meta id-type]
allocator_type get_allocator() const; // C++03
allocator_type get_allocator() const noexcept; // C++11basic_stringが内包しているアロケータを取得する。
basic_stringが内包しているアロケータ
投げない
noexcept修飾はC++11で追加された。
#include <cassert>
#include <string>
int main()
{
std::allocator<char> alloc;
std::string s(alloc);
std::allocator<char> result = s.get_allocator();
assert(result == alloc);
}- get_allocator()[color ff0000]
- std::allocator[link /reference/memory/allocator.md]
- C++03
- C++11
- Clang: 3.0, 3.1, 3.2, 3.3
- GCC: 4.3.6, 4.4.7, 4.5.4, 4.6.4, 4.7.3, 4.8.2
- GCC, C++11 mode:
- ICC: ??
- Visual C++: 2002, 2003, 2005, 2008, 2010, 2012, 2013, 2015, 2017
- 2012, 2013は、
noexceptが実装されていないため、throw()が修飾されている。 - 2015からは、
noexceptが修飾されている。
- 2012, 2013は、