Closed BigUglySpider closed 2 years ago
Addressed as of commit d4b90245fe84297b57fa18a8bec1e66a5f4be595 (for EmuMath::Vector
).
Matrix
implementation is still undecided, but no decision is being made for now. It will likely be decided after mutation (and related operations) is complete.
Closing this issue as a result; if Matrix STL iterator support is considered desirable, another issue should be made.
STL Iterators have been added to Matrix as of commit 0c0800af7fcc2b8a84db0de42a75233bdb05a76d, pull request #46.
EmuMath::Vector
As
Vector
is effectively a wrappedstd::array
(although this is not an EmuMath guarantee), it seems reasonable to allow the STL container interface to be used with it. This is especially the case for the few functions which break usual Emu library naming conventions to mimic STL functions (such asat
instead ofAt
).Under current implementations, this will be extremely trivial for value-containing
Vector
types. Reference-containingVector
types will need some additional work.EmuMath::Matrix
Matrices already provide a flattened index method of access, which provides column-major access regardless of a Matrix's actual major-storage order.
An STL iterator implementation will likely be in contiguous order to support a method of contiguous flattened access, and provide a similar interface to the
Vector
implementation.As of this issue's post, it is uncertain whether an iterator implementation will be provided for
Matrix
.Proposal for
EmuMath::Vector::iterator
(and variants)As
std::array
storage is not guaranteed byVector
, it would be preferable to implement a custom iterator for all kinds ofVector
, instead of conditionally choosing betweenstd::array::iterator
(and variants) or a custom iterator.Implementation
EmuMath::Vector
typearg.std::enable_if_t
trigger should be used to guarantee the provision ofEmuMath::Vector
types only, or alternatively a partial specialisation (std::enable_if_t
is more semantically clear for this).stored_type
.value_type
using value_type = Vec::value_type;
,using pointer_type = Vec::value_type*;
, etc...Vector
access, and keeping thestored_type
hidden to prevent easy nefarious use of contained reference wrappers.random_access_iterator
, providing the same level of permission as astd::array
.Vector
body itself. This is to allow for easy access to the iterator type forVector
specialisations.