23 #include <type_traits>
67 template <
unsigned int VDimension = 2>
68 struct ITK_TEMPLATE_EXPORT
Size final
82 static constexpr
unsigned int Dimension = VDimension;
95 for(
unsigned int i = 0; i < VDimension; i++ )
105 for(
unsigned int i = 0; i < VDimension; i++ )
118 for(
unsigned int i = 0; i < VDimension; i++ )
128 for(
unsigned int i = 0; i < VDimension; i++ )
141 for(
unsigned int i = 0; i < VDimension; i++ )
151 for(
unsigned int i = 0; i < VDimension; i++ )
163 return m_InternalArray;
185 m_InternalArray[element] = val;
196 return m_InternalArray[element];
203 std::fill_n(begin(), size(), value);
220 static_assert( VDimension > 0,
"Error: Only positive value sized VDimension allowed" );
246 std::fill_n(begin(), size(), newValue);
251 std::swap_ranges(begin(), end(), other.
begin() );
256 return iterator(&m_InternalArray[0]);
266 return iterator(&m_InternalArray[VDimension]);
311 return m_InternalArray[pos];
316 return m_InternalArray[pos];
321 ExceptionThrowingBoundsCheck(pos);
return m_InternalArray[pos];
326 ExceptionThrowingBoundsCheck(pos);
return m_InternalArray[pos];
341 return VDimension ? *(end() - 1) : *end();
346 return VDimension ? *(end() - 1) : *end();
351 return &m_InternalArray[0];
356 return &m_InternalArray[0];
362 if( pos >= VDimension )
364 throw std::out_of_range(
"array::ExceptionThrowingBoundsCheck");
371 template <
unsigned int VDimension>
372 std::ostream & operator<<(std::ostream & os, const Size<VDimension> & obj)
375 for(
unsigned int i = 0; i + 1 < VDimension; ++i )
377 os << obj[i] <<
", ";
379 if( VDimension >= 1 )
381 os << obj[VDimension - 1];
389 template <
unsigned int VDimension>
396 template <
unsigned int VDimension>
400 return !(one == two);
403 template <
unsigned int VDimension>
407 return std::lexicographical_compare(one.begin(), one.end(),
408 two.begin(), two.end() );
411 template <
unsigned int VDimension>
418 template <
unsigned int VDimension>
425 template <
unsigned int VDimension>
433 template <
unsigned int VDimension>
441 template<
unsigned int VDimension >
void assign(const value_type &newValue)
::itk::SizeValueType value_type
bool operator==(const Index< VDimension > &one, const Index< VDimension > &two)
constexpr size_type size() const
constexpr size_type max_size() const
const Self & operator*=(const Self &vec)
static constexpr unsigned int GetSizeDimension()
reference operator[](size_type pos)
unsigned long SizeValueType
reference at(size_type pos)
const Self & operator-=(const Self &vec)
const_reverse_iterator rend() const
const_iterator end() const
const Self operator+(const Self &vec) const
const Self & operator+=(const Self &vec)
SizeValueType m_InternalArray[VDimension]
bool operator>(const Index< VDimension > &one, const Index< VDimension > &two)
const value_type * const_iterator
const_reference at(size_type pos) const
constexpr unsigned int Dimension
const_iterator begin() const
const SizeValueType * data() const
void swap(Array< T > &a, Array< T > &b)
reverse_iterator rbegin()
bool operator!=(const Index< VDimension > &one, const Index< VDimension > &two)
const_reference back() const
const SizeValueType * GetSize() const
void ExceptionThrowingBoundsCheck(size_type pos) const
std::ptrdiff_t difference_type
Represent a n-dimensional size (bounds) of a n-dimensional image.
const value_type & const_reference
const Self operator*(const Self &vec) const
std::reverse_iterator< iterator > reverse_iterator
const_reference front() const
const_reference operator[](size_type pos) const
std::reverse_iterator< const_iterator > const_reverse_iterator
::itk::SizeValueType SizeValueType
void SetElement(unsigned long element, SizeValueType val)
const Self operator-(const Self &vec) const
void SetSize(const SizeValueType val[VDimension])
void Fill(SizeValueType value)
bool operator>=(const Index< VDimension > &one, const Index< VDimension > &two)
constexpr bool empty() const
SizeValueType GetElement(unsigned long element) const
const_reverse_iterator rbegin() const