16 #ifndef vtkCollectionRange_h
17 #define vtkCollectionRange_h
33 template <
typename CollectionType>
35 template <
typename CollectionType>
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*>;
134 auto elem = this->Element;
145 return lhs.Element == rhs.Element;
150 return lhs.Element != rhs.Element;
156 swap(lhs.Element, rhs.Element);
165 void Increment() noexcept
167 this->Element = this->Element->
Next;
170 ItemType* GetItem() const noexcept {
return static_cast<ItemType*
>(this->Element->
Item); }
179 template <
typename CollectionType>
180 struct CollectionRange
195 CollectionRange(CollectionType* coll) noexcept : Collection(coll) { assert(this->Collection); }
199 size_type size() const noexcept {
return this->Collection->GetNumberOfItems(); }
204 this->Collection->InitTraversal(cookie);
215 this->Collection->InitTraversal(cookie);
230 #endif // __VTK_WRAP__
232 #endif // vtkCollectionRange_h