34 template <
typename T,
int Size>
50 for (
int i = 0; i < Size; ++i)
52 this->
Data[i] = scalar;
63 for (
int i = 0; i < Size; ++i)
65 this->
Data[i] = init[i];
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]);
151 template <
typename A,
int Size>
152 ostream& operator<<(ostream& out, const vtkTuple<A, Size>& t)
156 for (
int i = 0; i < Size; ++i)
173 ostream& operator<<(ostream& out, const vtkTuple<unsigned char, Size>& t)
177 for (
int i = 0; i < Size; ++i)
187 out << static_cast<int>(t[i]);
198 template <
typename A,
int Size>
201 for (
int i = 0; i < Size; ++i)
215 template <
typename A,
int Size>
T Data[Size]
The only thing stored in memory!
vtkTuple< TR, Size > Cast() const
Cast the tuple to the specified type, returning the result.
T & operator[](int i)
Get a reference to the underlying data element of the tuple.
vtkTuple(const T &scalar)
Initialize all of the tuple's elements with the supplied scalar.
const T & operator[](int i) const
vtkTuple()
The default constructor does not initialize values.
bool Compare(const vtkTuple< T, Size > &other, const T &tol) const
Equality operator with a tolerance to allow fuzzy comparisons.
bool operator==(const vtkTuple< A, Size > &t1, const vtkTuple< A, Size > &t2)
Equality operator performs an equality check on each component.
bool operator!=(const vtkTuple< A, Size > &t1, const vtkTuple< A, Size > &t2)
Inequality for vector type.
templated base type for containers of constant size.
const T * GetData() const
vtkTuple(const T *init)
Initialize the tuple's elements with the elements of the supplied array.
T * GetData()
Get a pointer to the underlying data of the tuple.
T operator()(int i) const
Get the value of the tuple at the index specified.
int GetSize() const
Get the size of the tuple.