Closed niliopoulos closed 7 years ago
justification added
note regarding const access when std::is_const<element_type>
not applicable
to-be-done in subsequent revision
done
explicitly ruling out dynamic number of dimensions (non-static rank), implementation is not optimizable
done
array
yes, tuple
no; want optimizability
rank()
is rank_static()
10, 11, 12. using signed integer types throughout
constexpr
function values provides static access as long as the input argument is a literal value
Added appendix that references P0019, Atomic Reference as an example.
done
let' see how it goes in LEWG
If r
is a literal value or constexpr resolved value then this can be resolved at compile-time because rank()
is guaranteed constexpr. Otherwise r
is runtime values and a runtime check is necessary.
size()
is the number of unique elements in the domain, which follows conventional nomenclature
An implementation can optimize by pre-compute at construction and saving the value to avoid repeating the iteration on each query.
The codomain is defined to be a contiguous span of objects that must include all objects that can be referenced through the mdspan::operator()
. The set of referenced objects may be a non-contiguous subset of this span.
Clarified why / how
done
Example, a strided layout could be unique but is not guaranteed to be unique
Good discussion. I've pondered exposing the mapping
type and object instead of exposing them as a call-through. I added a subsection Mapping Observers - Alternative.
Needed if an application is going to allocate a codomain needs to be polymorphic on the layout and dimensions.
All should be index_type
, fixed.
Yes - please advocate for it!!!
Hopefully this just goes away...
Added requirement and noted to-be-done
29, 30. All should be index_type
, fixed.
Is all good due to the magical-goodness of constexpr
functions with integral values
Much thanks for the detailed review!
done in current version
Hello, This is a review of the current HEAD (6abdf1d8d) of the
P0009
proposal text.General
gsl::span
as well but I think some justification needs to be in place: How will queries interact with containers or codebases that usestd::size_t
?const_mdspan
class to indicate that this is a view that doesn't modify thecodomain
data?const_reference
andconst_pointer
?co-domain
space definition may need to be restricted a bit so that it cannot be interepreted that its elements may be pointers. (They could be with the exception of member-function pointers though).mdspan
with dynamic number of dimensions for a future addition?Section 3.2
msspan
->mdspan
operator()
be defined such that it works withstd::tuple
andstd::array
? (The constructor would be nice too).rank_static
?extent
member functionsint
, since it is required it to be>=0
?std::extent
integral constants arestd::size_t
. Shouldn't therank()
return type bestd::size_t
as well?extent
member functions returnstd::size_t
so that it is compatible withstd::extent
?extent
,static_extent
andstride
be implemented such that they can in addition take the index as a template parameter like:template <std::size_t I> constexpr const size_type &extent()
, or this functionallity will be just left tostd::extent
? Having static access will be necessary for compile-time algorithms."Extensions to access properties may cause reference to become a proxy type"
. This is very useful, can it be elaborated a bit more so that implementations do not lock out of such a feature?static_extent
. Maybe make itprivate
and introduce astatic constexpr bool is_static_extent<I>
member function. This will resolve the ambiguity of expressions like"A statically declared extent of dynamic_extent denotes that the extent is dynamic"
."If 0 <= r < rank() the extent of coordinate r. If rank() <= r then extent(r) == 1"
requires a run-time check. Should an alternative mechanism be proposed or just say Ifrank() <= r then extent(r) is undefined
?size()
be renamed toelement_count()
or similar?size()
algorithm should be a non-recursive compile time one.span()
function return ifis_always_contigous != true
?rank_dynamic() <= sizeof...(DynamicExtents)
and notrank_dynamic() == sizeof...(DynamicExtents)
?V::static_extent(r) == V::static_extent(r)
->V::static_extent(r) == U::static_extent(r)
static constexpr bool is_always_unique
: what is the meaning of always?mdspan
. For example thestride
member function may not be appropriate for user-defined layouts (let's say a symmetric matrix, where thestride
depends on the indices)required_span_size
.size_type
is used in 3.2.7 but not defined anywhere.Section 3.3
DynamicExtents
constructor should be disabled for an all-staticextents
.Section 3.4
Section 3.5
size_type
is used in 3.5.2 but not defined anywhere.extent
in the layout reference interface returns anindex_type
, but in the description asize_type
Best Regards, Nasos