std::mdspan<T,Extents,LayoutPolicy,AccessorPolicy>:: operator[]
|
template
<
class
...
OtherIndexTypes
>
constexpr reference operator [ ] ( OtherIndexTypes... indices ) const ; |
(1) | (начиная с C++23) |
|
template
<
class
OtherIndexType
>
constexpr
reference operator
[
]
|
(2) | (начиная с C++23) |
|
template
<
class
OtherIndexType
>
constexpr
reference operator
[
]
|
(3) | (начиная с C++23) |
Возвращает ссылку на indices -й элемент mdspan.
acc_
.
access
(
ptr_
,
map_
(
static_cast
<
index_type
>
(
std
::
move
(
indices
)
)
...
)
)
;
.
- ( std:: is_convertible_v < OtherIndexTypes, index_type > && ... )
- ( std:: is_nothrow_constructible_v < index_type, OtherIndexTypes > && ... )
- sizeof... ( OtherIndexTypes ) == rank ( )
|
Если
extents_type
::
|
(до C++26) |
|
Если
extents_type
::
|
(начиная с C++26) |
P
будет пакетом параметров таким, что
std::
is_same_v
<
std::
make_index_sequence
<
rank
(
)
>
,
std:: index_sequence < P... >> является true , эквивалентно return operator [ ] ( extents_type ::
index-cast
(
std::
as_const
(
indices
[
P
]
)
)
...
)
;
.
- std:: is_convertible_v < const OtherIndexType & , index_type >
- std:: is_nothrow_constructible_v < index_type, const OtherIndexType & >
Содержание |
Параметры
| indices | - | индексы элемента для доступа |
Возвращаемое значение
Ссылка на элемент.
Пример
|
Этот раздел не завершён
Причина: отсутствует пример |
Отчеты о дефектах
Следующие отчеты об изменениях поведения, влияющие на дефекты, были применены ретроактивно к ранее опубликованным стандартам C++.
| DR | Применяется к | Поведение в опубликованной версии | Корректное поведение |
|---|---|---|---|
| LWG 3974 | C++23 |
перегрузки
(2,3)
не применяли
extents_type::
index-cast
|
применяют |
Смотрите также
| Этот раздел не завершён |