Clarify single index API for data access.
This commit is contained in:
parent
a50098f761
commit
d89da18709
13 changed files with 249 additions and 128 deletions
|
|
@ -37,8 +37,9 @@ namespace rotgen
|
|||
using ptr_type = std::conditional_t<is_immutable, value_type const*, value_type*>;
|
||||
using stride_type = Stride;
|
||||
|
||||
static constexpr Index RowsAtCompileTime = Ref::RowsAtCompileTime;
|
||||
static constexpr Index ColsAtCompileTime = Ref::ColsAtCompileTime;
|
||||
static constexpr int RowsAtCompileTime = Ref::RowsAtCompileTime;
|
||||
static constexpr int ColsAtCompileTime = Ref::ColsAtCompileTime;
|
||||
static constexpr bool IsVectorAtCompileTime = Ref::IsVectorAtCompileTime;
|
||||
|
||||
map(ptr_type ptr, Index r, Index c, stride_type s) : parent(ptr, r, c, strides<storage_order>(s,r,c)) {}
|
||||
map(ptr_type ptr, Index r, Index c)
|
||||
|
|
@ -91,7 +92,7 @@ namespace rotgen
|
|||
}
|
||||
|
||||
value_type& operator()(Index i, Index j) requires(!is_immutable) { return parent::operator()(i,j); }
|
||||
value_type& operator()(Index i) requires(!is_immutable)
|
||||
value_type& operator()(Index i) requires(!is_immutable && IsVectorAtCompileTime)
|
||||
{
|
||||
assert( parent::innerStride() == 1
|
||||
&& parent::outerStride() ==(storage_order == RowMajor ? parent::cols() : parent::rows())
|
||||
|
|
@ -99,8 +100,13 @@ namespace rotgen
|
|||
return parent::operator()(i);
|
||||
}
|
||||
|
||||
value_type& operator[](Index i) requires(!is_immutable && IsVectorAtCompileTime)
|
||||
{
|
||||
return (*this)(i);
|
||||
}
|
||||
|
||||
value_type operator()(Index i, Index j) const { return parent::operator()(i,j); }
|
||||
value_type operator()(Index i) const
|
||||
value_type operator()(Index i) const requires(IsVectorAtCompileTime)
|
||||
{
|
||||
assert( parent::innerStride() == 1
|
||||
&& parent::outerStride() ==(storage_order == RowMajor ? parent::cols() : parent::rows())
|
||||
|
|
@ -108,6 +114,11 @@ namespace rotgen
|
|||
return parent::operator()(i);
|
||||
}
|
||||
|
||||
value_type operator[](Index i) const requires(IsVectorAtCompileTime)
|
||||
{
|
||||
return (*this)(i);
|
||||
}
|
||||
|
||||
auto evaluate() const { return *this; }
|
||||
decltype(auto) noalias() const { return *this; }
|
||||
decltype(auto) noalias() { return *this; }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue