tatami
C++ API for different matrix representations
|
View into a pre-allocated array. More...
#include <ArrayView.hpp>
Public Member Functions | |
ArrayView (const T *ptr, size_t number) | |
ArrayView () | |
size_t | size () const |
const T * | data () const |
const T * | begin () const |
const T * | end () const |
T | operator[] (size_t i) const |
View into a pre-allocated array.
This allows us to use a pre-existing array in the tatami classes, assuming that the array lives longer than the view created on it. We provide some methods to mimic a std::vector
for use within the tatami constructors. This is implemented in lieu of having access to C++20's std::span
class.
T | Array type, usually numeric. |
[in] | ptr | Pointer to the start of the array. The lifetime of the array is assumed to exceed that of the constructed ArrayView instance. |
number | Number of array elements. |
|
inline |
Default constructor to create a zero-length view.
|
inline |
std::vector
. std::vector
.
|
inline |
i | Index of the array. |
i
.