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

履歴 編集

function template
<mdspan>

std::layout_stride::mapping::operator==(C++23)

template<class OtherMapping>
friend constexpr bool operator==(const mapping& x, const OtherMapping& y) noexcept;

//operator==により、以下のオーバーロードが使用可能になる        
template<class OtherExtents>
friend constexpr bool operator!=(const mapping& x, const OtherMapping& y) noexcept;

概要

mappingの等値比較を行う。

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

  • layout-mapping-alike<OtherMapping>を満たすこと。
  • extents_type::rank() == OtherMapping::extents_type::rank()
  • OtherMapping::is_always_strided() == true

事前条件

OtherMappingレイアウトマッピング要件を満たすこと。

戻り値

説明専用の関数OFFSET(m)を下記の通り定義する:

  • 多次元インデクスが0次元のときm()
  • そうでなければ、多次元インデクス空間のサイズが0のとき値0
  • そうでなければ、多次元インデクス値の全要素が0である整数パックzを用いてm(z...)

下記条件を全て満たすとき、trueを返す。そうでなければ、falseを返す。

  • x.extents() == y.extents()
  • OFFSET(y) == 0
  • 全ての次元rにおいてx.stride(r) == y.stride(y)

例外

投げない

#include <cassert>
#include <array>
#include <mdspan>

int main()
{
  using Ext4x3x2 = std::extents<size_t, 4, 3, 2>;

  std::layout_stride::mapping<Ext4x3x2> map1{{}, std::array{1, 4, 12}};
  std::layout_left::mapping<Ext4x3x2>   mapL;
  assert(map1 == mapL);

  std::layout_stride::mapping<Ext4x3x2> map2{{}, std::array{6, 2, 1}};
  std::layout_right::mapping<Ext4x3x2>  mapR;
  assert(map2 == mapR);
}

出力

バージョン

言語

  • C++23

処理系

参照