24VTK_ABI_NAMESPACE_BEGIN
25template <
typename T,
int Size>
41 for (
int i = 0; i < Size; ++i)
43 this->
Data[i] = scalar;
54 for (
int i = 0; i < Size; ++i)
56 this->
Data[i] = init[i];
64 explicit vtkTuple(
const std::array<T, Size>& values)
66 std::copy(values.begin(), values.end(), this->Data);
96 assert(
"pre: index_in_bounds" && i >= 0 && i < Size);
111 for (
int i = 0; i < Size; ++i)
113 if (std::abs(this->
Data[i] - other.
Data[i]) >= tol)
126 template <
typename TR>
130 for (
int i = 0; i < Size; ++i)
132 result[i] =
static_cast<TR
>(this->
Data[i]);
151template <
typename A,
int Size>
156 for (
int i = 0; i < Size; ++i)
177 for (
int i = 0; i < Size; ++i)
187 out << static_cast<int>(t[i]);
198template <
typename A,
int Size>
201 for (
int i = 0; i < Size; ++i)
215template <
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.