18#ifndef itkFixedArray_h
19#define itkFixedArray_h
52template <
typename TValue,
unsigned int VLength = 3>
57 static constexpr unsigned int Length = VLength;
208 explicit FixedArray(
const std::array<ValueType, VLength> & stdArray)
210 std::copy_n(stdArray.cbegin(), VLength, m_InternalArray);
214 template <
typename TFixedArrayValueType>
219 for (
auto & element : m_InternalArray)
221 element =
static_cast<TValue
>(*input++);
225 template <
typename TScalarValue>
228 std::copy_n(r, VLength, m_InternalArray);
237 template <
typename TFixedArrayValueType>
243 for (
auto & element : m_InternalArray)
245 element =
static_cast<TValue
>(*input++);
267# pragma GCC diagnostic push
268# pragma GCC diagnostic ignored "-Warray-bounds"
275# pragma GCC diagnostic pop
284 m_InternalArray[index] = value;
289 return m_InternalArray[index];
297 return m_InternalArray;
303 return m_InternalArray;
309 return m_InternalArray;
315 return m_InternalArray;
349 return m_InternalArray;
355 return m_InternalArray;
358 constexpr const_iterator
361 return this->cbegin();
364 constexpr const_iterator
367 return m_InternalArray + VLength;
373 return m_InternalArray + VLength;
376 constexpr const_iterator
388 const_reverse_iterator
394 const_reverse_iterator
397 return this->crbegin();
406 const_reverse_iterator
412 const_reverse_iterator
415 return this->crend();
447 return MakeFilled<FixedArray>(value);
452template <
typename TValue,
unsigned int VLength>
457template <
typename TValue,
unsigned int VLength>
466#ifndef ITK_MANUAL_INSTANTIATION
467# include "itkFixedArray.hxx"
A const reverse iterator through an array.
ConstReverseIterator operator--(int)
ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION(ConstReverseIterator)
ConstReverseIterator(ConstIterator i)
ConstReverseIterator operator--()
ConstReverseIterator operator++()
const ValueType & operator*() const
ConstReverseIterator(const ReverseIterator &rit)
ConstIterator operator->() const
ConstReverseIterator operator++(int)
bool operator==(const ConstReverseIterator &rit) const
A reverse iterator through an array.
bool operator==(const ReverseIterator &rit) const
ReverseIterator operator--()
ReverseIterator operator++()
ReverseIterator operator--(int)
ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION(ReverseIterator)
ReverseIterator(Iterator i)
Iterator operator->() const
ValueType & operator*() const
ReverseIterator operator++(int)
Simulate a standard C array with copy semantics.
ConstIterator End() const
bool operator==(const FixedArray &r) const
constexpr SizeType size() const
itkLegacyMacro(ConstReverseIterator rBegin() const)
const ValueType * const_iterator
std::reverse_iterator< iterator > reverse_iterator
constexpr const_reference operator[](unsigned int index) const
const_reverse_iterator crend() const
FixedArray(const ValueType r[VLength])
const ValueType * GetDataPointer() const
constexpr iterator begin() noexcept
void swap(FixedArray &other)
FixedArray(const ValueType &)
constexpr const_iterator cbegin() const noexcept
const ValueType * data() const
ValueType * GetDataPointer()
FixedArray(const std::array< ValueType, VLength > &stdArray)
const ValueType * ConstIterator
ValueType[VLength] CArray
itkLegacyMacro(ConstReverseIterator rEnd() const)
const_reverse_iterator crbegin() const
constexpr iterator end() noexcept
reverse_iterator rbegin()
FixedArray(const TScalarValue *r)
static constexpr FixedArray Filled(const ValueType &value)
const_reverse_iterator rend() const
const_reference GetElement(unsigned int index) const
constexpr const_iterator cend() const noexcept
FixedArray & operator=(const FixedArray< TFixedArrayValueType, VLength > &r)
std::reverse_iterator< const_iterator > const_reverse_iterator
constexpr reference operator[](unsigned int index)
const ValueType & const_reference
FixedArray & operator=(const ValueType r[VLength])
itkLegacyMacro(ReverseIterator rBegin())
constexpr const_iterator begin() const noexcept
void SetElement(unsigned int index, const_reference value)
constexpr const_iterator end() const noexcept
ConstIterator Begin() const
ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION(FixedArray)
const ValueType * const_pointer
const_reverse_iterator rbegin() const
FixedArray(const FixedArray< TFixedArrayValueType, VLength > &r)
void Fill(const ValueType &)
itkLegacyMacro(ReverseIterator rEnd())
constexpr unsigned int Dimension
ImageBaseType::SizeType SizeType
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
void swap(Array< T > &a, Array< T > &b)
std::ostream & operator<<(std::ostream &os, const Array< TValue > &arr)
void swap(FixedArray< TValue, VLength > &a, FixedArray< TValue, VLength > &b)