The problem is in the definition of the MemoryArray concept:
/// Check if A is an Array and exposes its data() and its indexmap().strides()
template
concept MemoryArray = Array && requires(A &a) {
// We can acquire the pointer to the underlying data
{ a.data() } -> std::same_as<std::conditional_t<std::is_const_v, const get_value_t, get_value_t> *>;
// Exposes the memory stride for each dimension
{ a.indexmap().strides() } -> StdArrayOfLong;
};
Prerequisites
Description
array<const T, N> doesn't satisfy MemoryArray concept.
The problem is in the definition of the MemoryArray concept:
/// Check if A is an Array and exposes its
concept MemoryArray = Array && requires(A &a) {
data()
and itsindexmap().strides()
template// We can acquire the pointer to the underlying data { a.data() } -> std::same_as<std::conditional_t<std::is_const_v, const get_value_t, get_value_t> *>;
// Exposes the memory stride for each dimension { a.indexmap().strides() } -> StdArrayOfLong; };
{ a.data() } -> std::same_as<std::conditional_t<std::is_const_v, const get_value_t, get_value_t> *>;
will fail for any array/array_view since get_value_t decays away qualifiers.
Additional Information
Error message from gcc 11,2
.../c++/nda/concepts.hpp:103:35: in requirements with 'A& a' [with A = nda::basic_array_view<const double, 2, nda::C_layout, 'A', nda::default_accessor, nda::borrowed>] .../c++/nda/concepts.hpp:106:11: note: 'a.data()' does not satisfy return-type-requirement, because 106 | { a.data() } -> std::same_as<std::conditional_t<std::is_const_v, const get_value_t, get_value_t> >; |
~~^~ .../c++/nda/concepts.hpp:106:5: error: deduced expression type does not satisfy placeholder constraints 106 | { a.data() } -> std::same_as<std::conditional_t<std::is_const_v, const get_value_t, get_value_t> >; |^~~~~~~~~~~~~~~~~~~~~~~~