22#include <kiwano-physics/Global.h>
76 template <
typename _Ty>
80 using iterator_category = std::forward_iterator_tag;
81 using value_type = _Ty;
83 using reference = _Ty&;
84 using difference_type = ptrdiff_t;
86 IteratorImpl(
const _Ty& elem)
91 inline reference operator*()
const
93 return const_cast<reference
>(elem_);
96 inline pointer operator->()
const
98 return std::pointer_traits<pointer>::pointer_to(**
this);
101 inline IteratorImpl& operator++()
103 elem_ = elem_->GetNext();
107 inline IteratorImpl operator++(
int)
109 IteratorImpl old = *
this;
114 inline bool operator==(
const IteratorImpl& rhs)
const
116 return elem_ == rhs.elem_;
119 inline bool operator!=(
const IteratorImpl& rhs)
const
121 return !operator==(rhs);
129 using value_type = b2Contact*;
130 using iterator = IteratorImpl<value_type>;
131 using const_iterator = IteratorImpl<const value_type>;
140 inline const value_type& front()
const
145 inline value_type& front()
150 inline iterator begin()
152 return iterator(first_);
155 inline const_iterator begin()
const
160 inline const_iterator cbegin()
const
162 return const_iterator(first_);
165 inline iterator end()
167 return iterator(
nullptr);
170 inline const_iterator end()
const
175 inline const_iterator cend()
const
177 return const_iterator(
nullptr);
181 value_type first_ =
nullptr;
188 template <
typename _Ty>
192 using iterator_category = std::forward_iterator_tag;
193 using value_type = _Ty;
194 using pointer = _Ty*;
195 using reference = _Ty&;
196 using difference_type = ptrdiff_t;
198 inline IteratorImpl(
const _Ty& elem)
203 inline reference operator*()
const
205 return const_cast<reference
>(elem_);
208 inline pointer operator->()
const
210 return std::pointer_traits<pointer>::pointer_to(**
this);
213 inline IteratorImpl& operator++()
219 inline IteratorImpl operator++(
int)
221 IteratorImpl old = *
this;
226 inline bool operator==(
const IteratorImpl& rhs)
const
228 return elem_ == rhs.elem_;
231 inline bool operator!=(
const IteratorImpl& rhs)
const
233 return !operator==(rhs);
241 using value_type = b2ContactEdge*;
242 using iterator = IteratorImpl<value_type>;
243 using const_iterator = IteratorImpl<const value_type>;
252 inline const value_type& front()
const
257 inline value_type& front()
262 inline iterator begin()
264 return iterator(first_);
267 inline const_iterator begin()
const
272 inline const_iterator cbegin()
const
274 return const_iterator(first_);
277 inline iterator end()
279 return iterator(
nullptr);
282 inline const_iterator end()
const
287 inline const_iterator cend()
const
289 return const_iterator(
nullptr);