table of contents
std::extents::extents(3) | C++ Standard Libary | std::extents::extents(3) |
NAME¶
std::extents::extents - std::extents::extents
Synopsis¶
constexpr extents() = default; (1) (since C++23)
template< class OtherIndexType, std::size_t... OtherExtents >
constexpr explicit(/*see below*/) (2) (since C++23)
extents( const std::extents<OtherIndexType, OtherExtents...>&
other ) noexcept;
template< class... OtherIndexTypes > (3) (since C++23)
constexpr explicit extents( OtherIndexTypes... exts ) noexcept;
template< class OtherIndexType, std::size_t N >
constexpr explicit(N != rank_dynamic()) (4) (since C++23)
extents( std::span<OtherIndexType, N> exts ) noexcept;
template< class OtherIndexType, std::size_t N >
constexpr explicit(N != rank_dynamic()) (5) (since C++23)
extents( const std::array<OtherIndexType, N>& exts ) noexcept;
Construct an extents. One can construct extents from just dynamic extents,
which are
all the values getting stored, or from all the extents with a
precondition.
1) Default constructor. Initializes all dynamic extents to zero.
2) Conversion from another extents object. After construction, *this == other
is
true.
* The behavior is undefined if
* other.extent(r) != static_extent(r) for any r for which static_extent(r)
represents a static extent, or
* other.extent(r) is not representable as a value of type IndexType for any
rank
value r in other.
* This overload participates in overload resolution only if
* sizeof...(OtherExtents) == rank() is true, and
* ((OtherExtents == std::dynamic_extent || Extents == std::dynamic_extent ||
OtherExtents == Extents) && ...) is true.
* This constructor is explicit if
* ((Extents != std::dynamic_extent && OtherExtents ==
std::dynamic_extent) || ...)
is true, or
* std::numeric_limits<IndexType>::max() <
std::numeric_limits<OtherIndexType>::max() is true.
3) Let N be sizeof...(exts) and exts_arr be std::array<IndexType,
N>{static_cast<IndexType>(std::move(exts))...}, equivalent to
extents(exts_arr).
* This overload participates in overload resolution only if
* (std::is_convertible_v<OtherIndexTypes, IndexType> && ...) is
true,
* (std::is_nothrow_constructible_v<IndexType, OtherIndexTypes>
&& ...) is true,
and
* N == rank_dynamic() || N == rank() is true.
* The behavior is undefined if
* N != rank_dynamic() and exts_arr[r] is not equal to static_extent(r) for
any r
for which static_extent(r) represents a static extent, or
* an element in exts is negative or not representable as a value of type
IndexType.
4,5) If N equals rank_dynamic(), for all d in [0, rank_dynamic()),
direct-non-list-initializes dynamic-extents[d] with std::as_const(exts[d]).
Otherwise, for all d in [0, rank_dynamic()), direct-non-list-initializes
dynamic-extents[d] with std::as_const(exts[dynamic-index-inv(d)]).
* This overload participates in overload resolution only if
* std::is_convertible_v<const OtherIndexType&, IndexType> is true,
* std::is_nothrow_constructible_v<IndexType, const OtherIndexType&>
is true, and
* N == rank_dynamic() || N == rank() is true.
* The behavior is undefined if
* N != rank_dynamic() and exts[r] is not equal to static_extent(r) for any r
for
which static_extent(r) represents a static extent, or
* exts[r] is negative or not representable as a value of type IndexType for
any
rank index r.
Parameters¶
other - another extents to convert from
exts - represents the extents
Example¶
This section is incomplete
Reason: no example
See also¶
This section is incomplete
Categories:¶
* Todo no example
* Todo without reason
2024.06.10 | http://cppreference.com |