40#include <boost/aligned_storage.hpp>
67 template <
typename Iterator>
71 typedef typename std::iterator_traits<Iterator>::pointer
pointer;
72 typedef typename std::iterator_traits<Iterator>::reference
reference;
74 wrapper(Iterator aIterator) : iIterator(aIterator)
84 return new (aStorage)
wrapper(*
this);
94 return iIterator.operator*();
98 return iIterator.operator->();
103 iIterator.operator++();
108 iIterator.operator--();
123 return iIterator ==
dynamic_cast<const wrapper&
>(aOther).iIterator;
127 return !(*
this == aOther);
134 iWrappedIterator{ nullptr },
139 iWrappedIterator{ aOther.iInPlace ? aOther.iWrappedIterator->clone(
iIteratorStorage) : aOther.iWrappedIterator->clone() },
140 iInPlace{ aOther.iInPlace }
148 delete iWrappedIterator;
153 (*iWrappedIterator).operator++();
158 (*iWrappedIterator).operator--();
164 (*iWrappedIterator).operator++();
170 (*iWrappedIterator).operator--();
175 (*iWrappedIterator).operator+=(aDelta);
180 (*iWrappedIterator).operator-=(aDelta);
186 (*result.iWrappedIterator).
operator+=(aDelta);
192 (*result.iWrappedIterator).
operator-=(aDelta);
197 return (*iWrappedIterator).operator==(*aOther.iWrappedIterator);
201 return (*iWrappedIterator).operator!=(*aOther.iWrappedIterator);
204 template <
typename Iterator>
209 template <
typename Iterator1,
typename Iterator2,
typename... Rest>
214 template <
typename Iterator>
217 if (is_one_of<Iterator>())
226 template <
typename Iterator,
typename NextIterator,
typename... Rest>
229 if (is_one_of<NextIterator>())
235 return get<Iterator, Rest...>();
239 template <
typename Wrapper>
244 template <
typename Wrapper>
254 iWrappedIterator =
new Wrapper{ aWrapper };
260 return *iWrappedIterator;
264 return *iWrappedIterator;
269 std::aligned_storage<
sizeof(
void*) * 4>::type
iPad;
272 i_wrapper* iWrappedIterator;
276 template <
typename Iterator>
280 typedef typename std::iterator_traits<Iterator>::value_type
value_type;
281 typedef typename std::iterator_traits<Iterator>::pointer
pointer;
282 typedef typename std::iterator_traits<Iterator>::reference
reference;
356 template <
typename Iterator>
virtual i_wrapper * clone(void *aStorage) const =0
virtual ~i_wrapper()=default
virtual i_wrapper & operator+=(difference_type aDelta)=0
virtual i_wrapper & operator--()=0
virtual i_wrapper * clone() const =0
virtual i_wrapper & operator++()=0
virtual i_wrapper & operator-=(difference_type aDelta)=0
virtual bool operator!=(const i_wrapper &aOther) const =0
virtual bool operator==(const i_wrapper &aOther) const =0
i_wrapper * clone() const override
std::iterator_traits< Iterator >::reference reference
std::iterator_traits< Iterator >::pointer pointer
pointer operator->() const
wrapper & operator+=(difference_type aDelta) override
bool operator==(const i_wrapper &aOther) const override
wrapper & operator--() override
wrapper & operator-=(difference_type aDelta) override
i_wrapper * clone(void *aStorage) const override
bool operator!=(const i_wrapper &aOther) const override
reference operator*() const
wrapper & operator++() override
wrapper(Iterator aIterator)
generic_iterator(const generic_iterator &aOther)
generic_iterator & operator--()
i_wrapper & wrapped_iterator()
void construct(const Wrapper &aWrapper)
bool operator!=(const generic_iterator &aOther) const
const i_wrapper & wrapped_iterator() const
generic_iterator & operator-=(difference_type aDelta)
generic_iterator operator+(difference_type aDelta)
std::aligned_storage< sizeof(void *) *4 >::type iPad
virtual ~generic_iterator()
generic_iterator & operator++()
generic_iterator & operator+=(difference_type aDelta)
std::bidirectional_iterator_tag iterator_category
generic_iterator operator--(int)
generic_iterator operator++(int)
void construct2(const Wrapper &aWrapper, bool aInPlace)
generic_iterator operator-(difference_type aDelta)
bool operator==(const generic_iterator &aOther) const
char iIteratorStorage[sizeof(void *) *4]
std::ptrdiff_t difference_type
specialized_generic_iterator operator+(difference_type aDelta)
specialized_generic_iterator & operator--()
reference operator*() const
std::iterator_traits< Iterator >::reference reference
specialized_generic_iterator(const specialized_generic_iterator &aOther)
std::iterator_traits< Iterator >::value_type value_type
bool operator!=(const specialized_generic_iterator &aOther) const
pointer operator->() const
specialized_generic_iterator operator++(int)
specialized_generic_iterator & operator+=(difference_type aDelta)
specialized_generic_iterator & operator-=(difference_type aDelta)
std::iterator_traits< Iterator >::pointer pointer
specialized_generic_iterator operator-(difference_type aDelta)
std::iterator_traits< Iterator >::difference_type difference_type
specialized_generic_iterator & operator++()
bool operator==(const specialized_generic_iterator &aOther) const
specialized_generic_iterator(Iterator aIterator)
specialized_generic_iterator operator--(int)
specialized_generic_iterator(const generic_iterator &aOther)
specialized_generic_iterator< Iterator > make_generic_iterator(Iterator aIterator)
void advance(it_type &it, const distance_type distance)