Currently, dim has 3 template parameter compile-time constants. Each of these is implemented manually, resulting in a ~3x code duplication.
More importantly, methods like shape::min, shape::extent, and shape::stride lose compile-time constants, because they are simply instances of std::tuple<index_t, ...>.
This could be avoided if dim::min, dim::extent, etc. returned a constant<Value = UNK> object, and would reduce the code duplication.
The downside is errors would become less clear, and it would require implicit conversions from the new object to index_t for many basic operations, and might be annoying if it fails in some cases, or require a lot of operator overloading to implement <, <=, etc.
Currently,
dim
has 3 template parameter compile-time constants. Each of these is implemented manually, resulting in a ~3x code duplication.More importantly, methods like
shape::min
,shape::extent
, andshape::stride
lose compile-time constants, because they are simply instances ofstd::tuple<index_t, ...>
.This could be avoided if
dim::min
,dim::extent
, etc. returned aconstant<Value = UNK>
object, and would reduce the code duplication.The downside is errors would become less clear, and it would require implicit conversions from the new object to
index_t
for many basic operations, and might be annoying if it fails in some cases, or require a lot of operator overloading to implement <, <=, etc.