Skip to content

Latest commit

 

History

History
60 lines (43 loc) · 959 Bytes

op_xor_assign.md

File metadata and controls

60 lines (43 loc) · 959 Bytes

operator^=

  • cstddef[meta header]
  • std[meta namespace]
  • function[meta id-type]
  • cpp17[meta cpp]
namespace std {
  constexpr byte& operator^=(byte& l, byte r) noexcept;
}

概要

byte型のオブジェクトに対して、ビット排他的論理和の複合代入をする。

効果

以下の式と等価の効果をもつ:

return l = l ^ r;

例外

投げない

#include <cassert>
#include <cstddef>

int main()
{
  std::byte a{0b0000'0011};
  std::byte b{0b0000'0101};

  a ^= b;

  assert(static_cast<unsigned char>(a) == 0b0000'0110);
}

出力

バージョン

言語

  • C++17

処理系

参照