tatami
C++ API for different matrix representations
|
View into a pre-allocated array. More...
#include <ArrayView.hpp>
Public Member Functions | |
ArrayView (const Type_ *const ptr, const std::size_t number) | |
ArrayView () | |
std::size_t | size () const |
const Type_ * | data () const |
const Type_ * | begin () const |
const Type_ * | end () const |
Type_ | operator[] (std::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.
Type_ | Array type, usually numeric. |
|
inline |
[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 |
|
inline |
|
inline |
|
inline |
|
inline |
i | Index of the array. |
i
.