std::mdspan<T,Extents,LayoutPolicy,AccessorPolicy>:: operator[]
|
template
<
class
...
OtherIndexTypes
>
constexpr reference operator [ ] ( OtherIndexTypes... indices ) const ; |
(1) | (since C++23) |
|
template
<
class
OtherIndexType
>
constexpr
reference operator
[
]
|
(2) | (since C++23) |
|
template
<
class
OtherIndexType
>
constexpr
reference operator
[
]
|
(3) | (since C++23) |
Returns a reference to the indices th element of the 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 ( )
|
If
extents_type
::
|
(until C++26) |
|
If
extents_type
::
|
(since C++26) |
P
be a parameter pack such that
std::
is_same_v
<
std::
make_index_sequence
<
rank
(
)
>
,
std:: index_sequence < P... >> is true , equivalent to 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 & >
Contents |
Parameters
| indices | - | the indices of the element to access |
Return value
A reference to the element.
Example
|
This section is incomplete
Reason: no example |
Defect reports
The following behavior-changing defect reports were applied retroactively to previously published C++ standards.
| DR | Applied to | Behavior as published | Correct behavior |
|---|---|---|---|
| LWG 3974 | C++23 |
overloads
(2,3)
did not apply
extents_type::
index-cast
|
applies |
See also
| This section is incomplete |