allocator_type get_allocator() const noexcept;
概要
アロケータを取得する。
戻り値
内部の文字列バッファが保持しているアロケータのコピー。
例
#include <iostream>
#include <sstream>
int main()
{
std::stringbuf buf;
auto alloc = buf.get_allocator();
// アロケータの型名を出力(処理系依存)
std::cout << typeid(alloc).name() << std::endl;
}
出力例
std::allocator<char>
バージョン
言語
- C++20
処理系
- Clang: ??
- GCC: 12 ✅
- Visual C++: ??