16#ifndef vtkCollectionRange_h
17#define vtkCollectionRange_h
33template <
typename CollectionType>
34struct CollectionRange;
35template <
typename CollectionType>
36struct CollectionIterator;
45template <
typename CollectionType,
typename T = CollectionType>
51template <
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));
101template <
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); }
185template <
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);
vtkCollectionElement * Next
typename std::enable_if< IsCollection< CollectionType >::value, T >::type EnableIfIsCollection
Specialization of tuple ranges and iterators for vtkAOSDataArrayTemplate.
CollectionIterator operator++(int) noexcept
typename Superclass::value_type value_type
reference operator*() const noexcept
CollectionIterator & operator++() noexcept
typename Superclass::reference reference
CollectionIterator & operator=(const CollectionIterator &o) noexcept=default
typename Superclass::difference_type difference_type
typename Superclass::pointer pointer
CollectionIterator() noexcept
typename Superclass::iterator_category iterator_category
CollectionIterator(vtkCollectionElement *element) noexcept
friend void swap(CollectionIterator &lhs, CollectionIterator &rhs) noexcept
pointer operator->() const noexcept
CollectionIterator(const CollectionIterator &o) noexcept=default
friend bool operator==(const CollectionIterator &lhs, const CollectionIterator &rhs) noexcept
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