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

履歴 編集

function
<string>

std::basic_string::push_back

void push_back(charT c);           // (1) C++03
constexpr void push_back(charT c); // (1) C++20

概要

末尾に要素を追加する。

効果

append(static_cast<size_type>(1), c)

#include <iostream>
#include <string>

int main()
{
  std::string s = "hell";

  // 末尾に'o'を追加する
  s.push_back('o');

  std::cout << s << std::endl;
}

出力

hello

参照