17 #ifndef OPENKALMAN_CONSTANT_MDSPAN_POLICIES_HPP 18 #define OPENKALMAN_CONSTANT_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_;
90 template<
typename ElementType>
93 using element_type = ElementType;
94 using reference =
const element_type&;
95 using data_handle_type =
const element_type*;
100 template<stdex::convertible_to<element_type> OtherElementType>
102 template<
typename OtherElementType, std::enable_if_t<stdex::convertible_to<OtherElementType, element_type>,
int> = 0>
105 : element_ {other.element_} {}
107 #ifdef __cpp_concepts 108 template<stdex::convertible_to<element_type> OtherElementType>
110 template<
typename OtherElementType, std::enable_if_t<stdex::convertible_to<OtherElementType, element_type>,
int> = 0>
113 : element_ {std::move(other).element_} {}
118 access(data_handle_type p, std::size_t i)
const noexcept {
return element_; }
120 constexpr data_handle_type
121 offset(data_handle_type p, std::size_t i)
const noexcept {
return &element_; }
123 constexpr data_handle_type
124 data_handle()
const noexcept {
return &element_; }
128 const ElementType element_;
130 template<
typename OtherElementType>
131 friend struct accessor_constant;
Definition: constant_mdspan_policies.hpp:31
Definition: constant_mdspan_policies.hpp:28
Definition: constant_mdspan_policies.hpp:91
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
Basic definitions for OpenKalman as a whole.
Definition: basics.hpp:48