最終更新日時(UTC):
が更新

履歴 編集

function
<sstream>

std::basic_stringbuf::get_allocator(C++20)

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

処理系

参照