4#ifndef vtkCollectionRange_h
5#define vtkCollectionRange_h
18VTK_ABI_NAMESPACE_BEGIN
20template <
typename CollectionType>
21struct CollectionRange;
22template <
typename CollectionType>
23struct CollectionIterator;
32template <
typename CollectionType,
typename T = CollectionType>
38template <
typename CollectionType>
62 static auto GetType(...) ->
decltype(std::declval<T>().GetNextItemAsObject());
66 static auto GetType(
int) ->
decltype(std::declval<T>().GetNextItem());
68 using PointerType =
decltype(GetType<CollectionType>(0));
72 using Type =
typename std::remove_pointer<PointerType>::type;
88template <
typename CollectionType>
119 auto elem = this->Element;
130 return lhs.Element == rhs.Element;
135 return lhs.Element != rhs.Element;
141 swap(lhs.Element, rhs.Element);
153 void Increment() noexcept
155 this->Element = this->Element->
Next;
158 ItemType* GetItem() const noexcept {
return static_cast<ItemType*
>(this->Element->
Item); }
167template <
typename CollectionType>
186 assert(this->Collection);
191 size_type size() const noexcept {
return this->Collection->GetNumberOfItems(); }
196 this->Collection->InitTraversal(cookie);
207 this->Collection->InitTraversal(cookie);
vtkCollectionElement * Next
Hold a reference to a vtkObjectBase instance.
typename std::enable_if< IsCollection< CollectionType >::value, T >::type EnableIfIsCollection
Specialization of tuple ranges and iterators for vtkAOSDataArrayTemplate.
CollectionIterator operator++(int) noexcept
std::forward_iterator_tag iterator_category
typename GetCollectionItemType< CollectionType >::Type * pointer
reference operator*() const noexcept
CollectionIterator & operator++() noexcept
CollectionIterator & operator=(const CollectionIterator &o) noexcept=default
CollectionIterator() noexcept
CollectionIterator(vtkCollectionElement *element) noexcept
friend void swap(CollectionIterator &lhs, CollectionIterator &rhs) noexcept
typename GetCollectionItemType< CollectionType >::Type * reference
pointer operator->() const noexcept
CollectionIterator(const CollectionIterator &o) noexcept=default
friend bool operator==(const CollectionIterator &lhs, const CollectionIterator &rhs) noexcept
typename GetCollectionItemType< CollectionType >::Type * value_type
friend bool operator!=(const CollectionIterator &lhs, const CollectionIterator &rhs) noexcept
CollectionRange(CollectionType *coll) noexcept
ItemType * const_reference
CollectionType * GetCollection() const noexcept
typename GetCollectionItemType< CollectionType >::Type ItemType
size_type size() const noexcept
const_iterator cbegin() const
const_iterator cend() const
typename std::remove_pointer< PointerType >::type Type
void * vtkCollectionSimpleIterator