GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • cpprefjp - C++日本語リファレンス
  • GitHub Project

This view

  • Original page
  • New address

GeezerVison is showing cpprefjp.github.io — std::basic_spanstream::swap - cpprefjp C++日本語リファレンス

  1. リファレンス
  2. spanstream
  3. basic_spanstream
  4. swap

最終更新日時: 2025年08月11日 15時35分16秒 (JST)
suomesta が更新

履歴 編集

function
<spanstream>

std::basic_spanstream::swap(C++23)

void swap(basic_spanstream& rhs);

概要

値を交換する。

効果

basic_iostream<CharT, Traits>::swap(rhs)を呼び出し、sb.swap(rhs.sb)を実行する。ここでsbは内部のbasic_spanbufオブジェクトである。

例

#include <iostream>
#include <span>
#include <spanstream>

int main()
{
  char buf1[32] = "first";
  char buf2[32] = "second";
  std::spanstream ss1{std::span<char>(buf1)};
  std::spanstream ss2{std::span<char>(buf2)};

  // スワップ
  ss1.swap(ss2);

  std::cout << ss1.span().data() << std::endl;
  std::cout << ss2.span().data() << std::endl;
}

出力

second
first

バージョン

言語

  • C++23

処理系

  • Clang: ??
  • GCC: ??
  • Visual C++: ??
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.