CSelectionIterator: Make use of in-class initializers

This commit is contained in:
Lioncash 2020-07-10 15:43:36 -04:00
parent 21f66aa786
commit fe679e5479
1 changed files with 10 additions and 10 deletions

View File

@ -6,19 +6,19 @@
class CSelectionIterator class CSelectionIterator
{ {
CNodeSelection *mpSelection; CNodeSelection *mpSelection;
uint32 mCurrentIndex; uint32 mCurrentIndex = 0;
public: public:
CSelectionIterator(CNodeSelection *pSelection) explicit CSelectionIterator(CNodeSelection *pSelection)
: mpSelection(pSelection), mCurrentIndex(0) {} : mpSelection(pSelection) {}
inline void Next() { mCurrentIndex++; } void Next() { mCurrentIndex++; }
inline bool DoneIterating() const { return (mCurrentIndex == mpSelection->Size()); } bool DoneIterating() const { return (mCurrentIndex == mpSelection->Size()); }
inline operator bool() const { return !DoneIterating(); } explicit operator bool() const { return !DoneIterating(); }
inline CSceneNode* operator*() const { return mpSelection->At(mCurrentIndex); } CSceneNode* operator*() const { return mpSelection->At(mCurrentIndex); }
inline CSceneNode* operator->() const { return mpSelection->At(mCurrentIndex); } CSceneNode* operator->() const { return mpSelection->At(mCurrentIndex); }
inline CSelectionIterator& operator++() { Next(); return *this; } CSelectionIterator& operator++() { Next(); return *this; }
inline CSelectionIterator operator++(int) { CSelectionIterator Copy = *this; Next(); return Copy; } CSelectionIterator operator++(int) { CSelectionIterator Copy = *this; Next(); return Copy; }
}; };
#endif // CSELECTIONITERATOR #endif // CSELECTIONITERATOR