36template <
typename T,
int Size>
52 for (
int i = 0; i < Size; ++i)
54 this->
Data[i] = scalar;
65 for (
int i = 0; i < Size; ++i)
67 this->
Data[i] = init[i];
75 explicit vtkTuple(
const std::array<T, Size>& values)
77 std::copy(values.begin(), values.end(), this->Data);
107 assert(
"pre: index_in_bounds" && i >= 0 && i < Size);
108 return this->
Data[i];
122 for (
int i = 0; i < Size; ++i)
124 if (std::abs(this->
Data[i] - other.
Data[i]) >= tol)
137 template <
typename TR>
141 for (
int i = 0; i < Size; ++i)
143 result[i] =
static_cast<TR
>(this->
Data[i]);
162template <
typename A,
int Size>
167 for (
int i = 0; i < Size; ++i)
188 for (
int i = 0; i < Size; ++i)
198 out << static_cast<int>(t[i]);
209template <
typename A,
int Size>
212 for (
int i = 0; i < Size; ++i)
226template <
typename A,
int Size>
templated base type for containers of constant size.
bool Compare(const vtkTuple< T, Size > &other, const T &tol) const
Equality operator with a tolerance to allow fuzzy comparisons.
vtkTuple(const T *init)
Initialize the tuple's elements with the elements of the supplied array.
int GetSize() const
Get the size of the tuple.
vtkTuple< TR, Size > Cast() const
Cast the tuple to the specified type, returning the result.
vtkTuple(const T &scalar)
Initialize all of the tuple's elements with the supplied scalar.
T * GetData()
Get a pointer to the underlying data of the tuple.
T & operator[](int i)
Get a reference to the underlying data element of the tuple.
vtkTuple(const std::array< T, Size > &values)
Initialize the tuple's elements using a std::array for matching type and size.
const T * GetData() const
T Data[Size]
The only thing stored in memory!
T operator()(int i) const
Get the value of the tuple at the index specified.
const T & operator[](int i) const
vtkTuple()=default
The default constructor does not initialize values.
bool operator!=(const vtkTuple< A, Size > &t1, const vtkTuple< A, Size > &t2)
Inequality for vector type.
bool operator==(const vtkTuple< A, Size > &t1, const vtkTuple< A, Size > &t2)
Equality operator performs an equality check on each component.
ostream & operator<<(ostream &out, const vtkTuple< A, Size > &t)
Output the contents of a tuple, mainly useful for debugging.