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::simd::rebind - cpprefjp C++日本語リファレンス

  1. リファレンス
  2. simd
  3. rebind

最終更新日時: 2026年07月31日 23時18分35秒 (JST)
Akira Takahashi が更新

履歴 編集

class template
<simd>

std::simd::rebind(C++26)

namespace std::simd {
  template<class T, class V>
  struct rebind { using type = /*see below*/; };

  template<class T, class V>
  using rebind_t = rebind<T, V>::type;
}

概要

rebindは、データ並列型V(basic_vecまたはbasic_mask)の要素数(「width」)を維持したまま、要素型をTに変更した型を取得する型特性である。

メンバtypeは、Vがデータ並列型であり、要素型をTとしVと同じ要素数を持つデータ並列型が存在する場合にのみ存在する。存在するときtypeは次を表す。

  • Vがbasic_vecの特殊化のとき: 要素型T・Vと同じ要素数のbasic_vec
  • Vがbasic_maskの特殊化のとき: 対応するbasic_mask

例

#include <simd>
#include <print>
#include <type_traits>

namespace simd = std::simd;

int main()
{
  using Vi = simd::vec<int, 4>;

  // 要素数4を維持したまま要素型をfloatに変更
  using Vf = simd::rebind_t<float, Vi>;

  std::println("{}", std::is_same_v<Vf, simd::vec<float, 4>>);
}

出力

true

バージョン

言語

  • C++26

処理系

  • Clang: 22 ❌
  • GCC: 16.1 ❌
  • Visual C++: 2026 Update 2 ❌

関連項目

  • std::simd::resize
  • std::simd::basic_vec

参照

  • P1928R15 std::simd — merge data-parallel types from the Parallelism TS 2
    • C++26でstd::simdライブラリが追加された
You are visitor 01402503 — 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.