34 template<
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];
98 assert(
"pre: index_in_bounds" && i >= 0 && i < Size);
113 for (
int i = 0; i < Size; ++i)
115 if (std::abs(this->
Data[i] - other.
Data[i]) >= tol)
128 template<
typename TR>
132 for (
int i = 0; i < Size; ++i)
134 result[i] =
static_cast<TR
>(this->
Data[i]);
153 template<
typename A,
int Size>
154 ostream& operator<<(ostream& out, const vtkTuple<A, Size>& t)
158 for (
int i = 0; i < Size; ++i)
175 ostream& operator<<(ostream& out, const vtkTuple<unsigned char, Size>& t)
179 for (
int i = 0; i < Size; ++i)
189 out << static_cast<int>(t[i]);
200 template<
typename A,
int Size>
203 for (
int i = 0; i < Size; ++i)
217 template<
typename A,
int Size>
T Data[Size]
The only thing stored in memory!
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.
vtkTuple()
The default constructor does not initialize values.
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.
vtkTuple< TR, Size > Cast() const
Cast the tuple to the specified type, returning the result.
templated base type for containers of constant size.
vtkTuple(const T *init)
Initalize the tuple's elements with the elements of the supplied array.
T operator()(int i) const
Get the value of the tuple at the index specifed.
T * GetData()
Get a pointer to the underlying data of the tuple.
const T & operator[](int i) const
int GetSize() const
Get the size of the tuple.
const T * GetData() const
bool Compare(const vtkTuple< T, Size > &other, const T &tol) const
Equality operator with a tolerance to allow fuzzy comparisons.