tatami
C++ API for different matrix representations
Loading...
Searching...
No Matches
ArrayView.hpp
Go to the documentation of this file.
1#ifndef TATAMI_ARRAY_VIEW_HPP
2#define TATAMI_ARRAY_VIEW_HPP
3
9namespace tatami {
10
20template<typename T>
21class ArrayView {
22public:
28 ArrayView(const T* ptr, size_t number) : my_ptr(ptr), my_number(number) {}
29
34
38 size_t size() const { return my_number; }
39
43 const T* data() const { return my_ptr; }
44
48 const T* begin() const { return my_ptr; }
49
53 const T* end() const { return my_ptr + my_number; }
54
59 T operator[](size_t i) const {
60 return my_ptr[i];
61 }
62
63private:
64 const T* my_ptr;
65 size_t my_number;
66};
67
68}
69
70#endif
View into a pre-allocated array.
Definition ArrayView.hpp:21
T operator[](size_t i) const
Definition ArrayView.hpp:59
const T * begin() const
Definition ArrayView.hpp:48
const T * data() const
Definition ArrayView.hpp:43
ArrayView()
Definition ArrayView.hpp:33
size_t size() const
Definition ArrayView.hpp:38
const T * end() const
Definition ArrayView.hpp:53
ArrayView(const T *ptr, size_t number)
Definition ArrayView.hpp:28
Flexible representations for matrix data.
Definition Extractor.hpp:15
auto consecutive_extractor(const Matrix< Value_, Index_ > *mat, bool row, Index_ iter_start, Index_ iter_length, Args_ &&... args)
Definition consecutive_extractor.hpp:35