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
typename std::remove_pointer< PointerType >::type Type
void * vtkCollectionSimpleIterator
const_iterator cbegin() const
ItemType * const_reference
typename std::enable_if< IsCollection< CollectionType >::value, T >::type EnableIfIsCollection
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
typename Superclass::pointer pointer
pointer operator->() const noexcept
const_iterator cend() const
friend bool operator!=(const CollectionIterator &lhs, const CollectionIterator &rhs) noexcept
size_type size() const noexcept
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
reference operator*() const noexcept
CollectionType * GetCollection() const noexcept
CollectionRange(CollectionType *coll) noexcept
typename Superclass::reference reference
friend bool operator==(const CollectionIterator &lhs, const CollectionIterator &rhs) noexcept
typename Superclass::value_type value_type
CollectionIterator() noexcept