16 #ifndef vtkCollectionRange_h
17 #define vtkCollectionRange_h
33 template <
typename CollectionType>
34 struct CollectionRange;
35 template <
typename CollectionType>
36 struct CollectionIterator;
45 template <
typename CollectionType,
typename T = CollectionType>
51 template <
typename CollectionType>
75 static auto GetType(...) -> decltype(std::declval<T>().GetNextItemAsObject());
79 static auto GetType(
int) -> decltype(std::declval<T>().GetNextItem());
81 using PointerType = decltype(GetType<CollectionType>(0));
101 template <
typename CollectionType>
103 :
public std::iterator<std::forward_iterator_tag,
104 typename GetCollectionItemType<CollectionType>::Type*, int,
105 typename GetCollectionItemType<CollectionType>::Type*,
106 typename GetCollectionItemType<CollectionType>::Type*>
112 using Superclass = std::iterator<std::forward_iterator_tag, ItemType*, int, ItemType*, ItemType*>;
137 auto elem = this->Element;
148 return lhs.Element == rhs.Element;
153 return lhs.Element != rhs.Element;
159 swap(lhs.Element, rhs.Element);
171 void Increment() noexcept
173 this->Element = this->Element->
Next;
176 ItemType* GetItem() const noexcept {
return static_cast<ItemType*
>(this->Element->
Item); }
185 template <
typename CollectionType>
204 assert(this->Collection);
209 size_type size() const noexcept {
return this->Collection->GetNumberOfItems(); }
214 this->Collection->InitTraversal(cookie);
225 this->Collection->InitTraversal(cookie);
240 #endif // __VTK_WRAP__
242 #endif // vtkCollectionRange_h