最終更新日時:
が更新

履歴 編集

function
<simd>

std::simd::basic_vec::operator%=(C++26)

friend constexpr basic_vec& operator%=(basic_vec& lhs, const basic_vec& rhs) noexcept;

概要

2つのbasic_vecオブジェクトを要素ごとに剰余算し、その結果を左辺に代入する。

テンプレートパラメータ制約

value_type型の値a, bに対して、式a % bが有効であること。

効果

lhsrhsに対して、剰余算を要素ごとの演算として適用する。

戻り値

lhs

例外

投げない

#include <simd>
#include <print>

namespace simd = std::simd;

int main()
{
  simd::vec<int, 4> a = [](int i) { return i + 10; };  // {10, 11, 12, 13}
  simd::vec<int, 4> b = 3;                             // {3, 3, 3, 3}

  a %= b;

  for (int i = 0; i < a.size(); ++i) {
    std::print("{} ", a[i]);
  }
  std::println("");
}

出力

1 2 0 1 

バージョン

言語

  • C++26

処理系

関連項目

参照