16 template <
typename T,
typename TCounter = Size>
37 , actSize(other.actSize) {}
45 this->data = other.data;
46 this->actSize = other.actSize;
72 SPH_ASSERT(
unsigned(idx) <
unsigned(actSize), idx, actSize);
77 SPH_ASSERT(
unsigned(idx) <
unsigned(actSize), idx, actSize);
93 return data[actSize - 1];
98 return data[actSize - 1];
102 return this->actSize;
106 return this->actSize == 0;
116 return data ==
nullptr;
120 return data !=
nullptr;
125 if (actSize != other.actSize) {
128 for (TCounter i = 0; i < actSize; ++i) {
129 if (data[i] != other[i]) {
138 return !(*
this == other);
145 for (
const T& t : array) {
146 stream << t << std::endl;
152 template <
typename T>
158 for (
Size i = 0; i < v1.
size(); ++i) {
166 template <
typename T>
INLINE ArrayView< T > getSingleValueView(T &value)
bool almostEqual(const ArrayView< T > v1, const ArrayView< T > v2, const Float &eps)
#define SPH_ASSERT(x,...)
uint32_t Size
Integral type used to index arrays (by default).
double Float
Precision used withing the code. Use Float instead of float or double where precision is important.
Ordinary iterator for custom containers.
#define INLINE
Macros for conditional compilation based on selected compiler.
#define NAMESPACE_SPH_END
Object providing safe access to continuous memory of data.
INLINE Iterator< const StorageType > begin() const
INLINE const T & front() const
bool operator!=(const ArrayView &other) const
Inequality operator.
INLINE const T & back() const
INLINE ArrayView(const ArrayView &other)
friend std::ostream & operator<<(std::ostream &stream, const ArrayView &array)
Prints content of arrayview to stream.
bool operator==(const ArrayView &other) const
Comparison operator, comparing arrayviews element-by-element.
INLINE bool empty() const
INLINE bool operator!() const
INLINE const T & operator[](const TCounter idx) const
INLINE TCounter size() const
INLINE ArrayView(StorageType *data, TCounter size)
INLINE ArrayView subset(const TCounter start, const TCounter length) const
Returns a subset of the arrayview.
INLINE Iterator< const StorageType > end() const
INLINE T & operator[](const TCounter idx)
INLINE Iterator< StorageType > begin()
INLINE ArrayView & operator=(const ArrayView &other)
Copy operator.
INLINE Iterator< StorageType > end()
INLINE ArrayView(std::nullptr_t)
Explicitly initialize to nullptr.
Simple (forward) iterator over continuous array of objects of type T.