Skip to content

Commit

Permalink
mdspan/aligned_accessor: 全メンバ P2897R7(#1380)
Browse files Browse the repository at this point in the history
  • Loading branch information
yohhoy committed Dec 22, 2024
1 parent c763f14 commit 0353f38
Show file tree
Hide file tree
Showing 5 changed files with 179 additions and 4 deletions.
8 changes: 4 additions & 4 deletions reference/mdspan/aligned_accessor.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ namespace std {
| 名前 | 説明 | 対応バージョン |
|------|------|----------------|
| [`(constructor)`](aligned_accessor/op_constructor.md.nolink) | コンストラクタ | C++26 |
| [`(constructor)`](aligned_accessor/op_constructor.md) | コンストラクタ | C++26 |
| `(destructor)` | デストラクタ | C++26 |
| [`operator default_accessor`](aligned_accessor/op_default_accessor.md.nolink) | [`default_accessor`](default_accessor.md)型への変換演算子 | C++26 |
| [`access`](aligned_accessor/access.md.nolink) | 指定オフセット位置にある要素へアクセスする | C++26 |
| [`offset`](aligned_accessor/offset.md.nolink) | 指定オフセット位置のハンドルを取得する | C++26 |
| [`operator default_accessor`](aligned_accessor/op_default_accessor.md) | [`default_accessor`](default_accessor.md)型への変換演算子 | C++26 |
| [`access`](aligned_accessor/access.md) | 指定オフセット位置にある要素へアクセスする | C++26 |
| [`offset`](aligned_accessor/offset.md) | 指定オフセット位置のハンドルを取得する | C++26 |
## メンバ型
Expand Down
41 changes: 41 additions & 0 deletions reference/mdspan/aligned_accessor/access.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# access
* mdspan[meta header]
* function[meta id-type]
* std[meta namespace]
* aligned_accessor[meta class]
* cpp26[meta cpp]

```cpp
constexpr reference access(data_handle_type p, size_t i) const noexcept;
```
## 概要
指定オフセット位置にある要素へアクセスする。
## 事前条件
- 半開区間`[0, i+1)`が有効な範囲であり、かつ
- [`is_sufficiently_aligned`](/reference/memory/is_sufficiently_aligned.md)`<byte_alignment>(p)`が`true`であること。
## 効果
`return` [`assume_aligned`](/reference/memory/assume_aligned.md)`<byte_alignment>(p)[i];`と等価
## 例外
投げない
## バージョン
### 言語
- C++26
### 処理系
- [Clang](/implementation.md#clang): ??
- [GCC](/implementation.md#gcc): ??
- [ICC](/implementation.md#icc): ??
- [Visual C++](/implementation.md#visual_cpp): ??
## 参照
- [P2897R7 `aligned_accessor`: An mdspan accessor expressing pointer over-alignment](https://open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2897r7.html)
42 changes: 42 additions & 0 deletions reference/mdspan/aligned_accessor/offset.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# offset
* mdspan[meta header]
* function[meta id-type]
* std[meta namespace]
* aligned_accessor[meta class]
* cpp26[meta cpp]

```cpp
constexpr typename offset_policy::data_handle_type
offset(data_handle_type p, size_t i) const noexcept;
```
## 概要
指定オフセット位置のハンドルを取得する。
## 事前条件
- 半開区間`[0, i+1)`が有効な範囲であり、かつ
- [`is_sufficiently_aligned`](/reference/memory/is_sufficiently_aligned.md)`<byte_alignment>(p)`が`true`であること。
## 効果
`return` [`assume_aligned`](/reference/memory/assume_aligned.md)`<byte_alignment>(p) + i;`と等価
## 例外
投げない
## バージョン
### 言語
- C++26
### 処理系
- [Clang](/implementation.md#clang): ??
- [GCC](/implementation.md#gcc): ??
- [ICC](/implementation.md#icc): ??
- [Visual C++](/implementation.md#visual_cpp): ??
## 参照
- [P2897R7 `aligned_accessor`: An mdspan accessor expressing pointer over-alignment](https://open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2897r7.html)
50 changes: 50 additions & 0 deletions reference/mdspan/aligned_accessor/op_constructor.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# コンストラクタ
* mdspan[meta header]
* function[meta id-type]
* std[meta namespace]
* aligned_accessor[meta class]
* cpp26[meta cpp]

```cpp
constexpr aligned_accessor() noexcept = default; // (1)

template<class OtherElementType, size_t OtherByteAlignment>
constexpr aligned_accessor(
aligned_accessor<OtherElementType, OtherByteAlignment>) noexcept; // (2)

template<class OtherElementType>
explicit constexpr aligned_accessor(
default_accessor<OtherElementType>) noexcept; // (3)
```
* default_accessor[link ../default_accessor.md]
## 概要
- (1) : デフォルトコンストラクタ
- (2) : 他`aligned_accessor`からの変換コンストラクタ
- (3) : [`default_accessor`](../default_accessor.md)からの変換コンストラクタ
## テンプレートパラメータ制約
- (2) :
- [`is_convertible_v`](/reference/type_traits/is_convertible.md)`<OtherElementType(*)[], element_type(*)[]>`が`true`であること
- `OtherByteAlignment > byte_alignment`
- (3) : [`is_convertible_v`](/reference/type_traits/is_convertible.md)`<OtherElementType(*)[], element_type(*)[]>`が`true`であること
## 例外
投げない
## バージョン
### 言語
- C++26
### 処理系
- [Clang](/implementation.md#clang): ??
- [GCC](/implementation.md#gcc): ??
- [ICC](/implementation.md#icc): ??
- [Visual C++](/implementation.md#visual_cpp): ??
## 参照
- [P2897R7 `aligned_accessor`: An mdspan accessor expressing pointer over-alignment](https://open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2897r7.html)
42 changes: 42 additions & 0 deletions reference/mdspan/aligned_accessor/op_default_accessor.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# operator default_accessor
* mdspan[meta header]
* function template[meta id-type]
* std[meta namespace]
* aligned_accessor[meta class]
* cpp26[meta cpp]

```cpp
template<class OtherElementType>
constexpr operator default_accessor<OtherElementType>() const noexcept;
```
* default_accessor[link ../default_accessor.md]

## 概要
[`default_accessor`](../default_accessor.md)型への変換演算子


## テンプレートパラメータ制約
[`is_convertible_v`](/reference/type_traits/is_convertible.md)`<element_type(*)[], OtherElementType(*)[]>``true`であること


## 効果
`return {};`と等価


## 例外
投げない


## バージョン
### 言語
- C++26

### 処理系
- [Clang](/implementation.md#clang): ??
- [GCC](/implementation.md#gcc): ??
- [ICC](/implementation.md#icc): ??
- [Visual C++](/implementation.md#visual_cpp): ??


## 参照
- [P2897R7 `aligned_accessor`: An mdspan accessor expressing pointer over-alignment](https://open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2897r7.html)

0 comments on commit 0353f38

Please sign in to comment.