16 #ifndef vtkCollectionRange_h
17 #define vtkCollectionRange_h
31 template <
typename CollectionType>
33 template <
typename CollectionType>
43 template <
typename CollectionType,
typename T = CollectionType>
49 template <
typename CollectionType>
73 static auto GetType(...) -> decltype(std::declval<T>().GetNextItemAsObject());
77 static auto GetType(
int) -> decltype(std::declval<T>().GetNextItem());
79 using PointerType = decltype(GetType<CollectionType>(0));
99 template <
typename CollectionType>
101 :
public std::iterator<std::forward_iterator_tag,
102 typename GetCollectionItemType<CollectionType>::Type*, int,
103 typename GetCollectionItemType<CollectionType>::Type*,
104 typename GetCollectionItemType<CollectionType>::Type*>
110 using Superclass = std::iterator<std::forward_iterator_tag, ItemType*, int, ItemType*, ItemType*>;
135 auto elem = this->Element;
146 return lhs.Element == rhs.Element;
151 return lhs.Element != rhs.Element;
157 swap(lhs.Element, rhs.Element);
169 void Increment() noexcept
171 this->Element = this->Element->
Next;
174 ItemType* GetItem() const noexcept {
return static_cast<ItemType*
>(this->Element->
Item); }
183 template <
typename CollectionType>
184 struct CollectionRange
202 assert(this->Collection);
207 size_type size() const noexcept {
return this->Collection->GetNumberOfItems(); }
212 this->Collection->InitTraversal(cookie);
223 this->Collection->InitTraversal(cookie);
238 #endif // vtkCollectionRange_h
typename std::remove_pointer< PointerType >::type Type
void * vtkCollectionSimpleIterator
ItemType * const_reference
typename std::enable_if< IsCollection< CollectionType >::value, T >::type EnableIfIsCollection
size_type size() const noexcept
typename Superclass::difference_type difference_type
friend void swap(CollectionIterator &lhs, CollectionIterator &rhs) noexcept
Specialization of tuple ranges and iterators for vtkAOSDataArrayTemplate.
CollectionIterator & operator++() noexcept
pointer operator->() const noexcept
typename Superclass::pointer pointer
friend bool operator!=(const CollectionIterator &lhs, const CollectionIterator &rhs) noexcept
const_iterator cend() const
typename Superclass::iterator_category iterator_category
CollectionIterator operator++(int) noexcept
CollectionIterator & operator=(const CollectionIterator &o) noexcept=default
CollectionIterator(vtkCollectionElement *element) noexcept
typename GetCollectionItemType< CollectionType >::Type ItemType
vtkCollectionElement * Next
const_iterator cbegin() const
CollectionRange(CollectionType *coll) noexcept
typename Superclass::reference reference
friend bool operator==(const CollectionIterator &lhs, const CollectionIterator &rhs) noexcept
typename Superclass::value_type value_type
reference operator*() const noexcept
CollectionType * GetCollection() const noexcept
CollectionIterator() noexcept