17 #ifndef OPENKALMAN_DIAGONAL_MDSPAN_POLICIES_HPP 18 #define OPENKALMAN_DIAGONAL_MDSPAN_POLICIES_HPP 30 template<
class Extents>
33 using extents_type = Extents;
34 using index_type =
typename extents_type::index_type;
35 using size_type =
typename extents_type::size_type;
36 using rank_type =
typename extents_type::rank_type;
40 mapping(
const extents_type& e) : extents_(e) {}
42 constexpr
const extents_type&
43 extents()
const noexcept {
return extents_; }
47 operator() (std::convertible_to<index_type>
auto...i)
const 49 template<
typename...IndexTypes, std::enable_if_t<
50 (... and std::is_convertible_v<IndexTypes, index_type>),
int> = 0>
51 operator() (IndexTypes...i)
const 58 required_span_size()
const noexcept {
return 0; }
60 static constexpr
bool is_always_unique() noexcept {
return false; }
61 static constexpr
bool is_always_exhaustive() noexcept {
return false; }
62 static constexpr
bool is_always_strided() noexcept {
return false; }
64 constexpr
bool is_unique()
const {
return false; }
65 constexpr
bool is_exhaustive()
const {
return false; }
66 constexpr
bool is_strided()
const {
return false; }
69 stride(std::size_t)
const {
return 0; }
71 template<
class OtherExtents>
75 return lhs.extents() == rhs.extents();
80 extents_type extents_;
91 template<
typename ElementType>
94 using element_type = ElementType;
95 using reference =
const element_type&;
96 using data_handle_type =
const element_type*;
100 #ifdef __cpp_concepts 101 template<stdex::convertible_to<element_type> OtherElementType>
103 template<
typename OtherElementType, std::enable_if_t<stdex::convertible_to<OtherElementType, element_type>,
int> = 0>
106 : element_ {other.element_} {}
108 #ifdef __cpp_concepts 109 template<stdex::convertible_to<element_type> OtherElementType>
111 template<
typename OtherElementType, std::enable_if_t<stdex::convertible_to<OtherElementType, element_type>,
int> = 0>
114 : element_ {std::move(other).element_} {}
119 access(data_handle_type p, std::size_t i)
const noexcept {
return element_; }
121 constexpr data_handle_type
122 offset(data_handle_type p, std::size_t i)
const noexcept {
return &element_; }
124 constexpr data_handle_type
125 data_handle()
const noexcept {
return &element_; }
129 nested_mapping_type nested_mapping_;
130 const ElementType element_;
132 template<
typename OtherElementType>
133 friend struct accessor_diagonal;
Definition: diagonal_mdspan_policies.hpp:31
Definition: diagonal_mdspan_policies.hpp:92
decltype(auto) constexpr access(Arg &&arg, const Indices &indices)
Access a component of an indexible object at a given set of indices.
Definition: access.hpp:74
Definition: diagonal_mdspan_policies.hpp:28
Basic definitions for OpenKalman as a whole.
Definition: basics.hpp:48