MCPcopy Create free account
hub / github.com/HaxeFoundation/hxcpp / ArrayIterator

Class ArrayIterator

include/Array.h:73–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71// An object that conforms to the standard iterator interface for arrays
72template<typename FROM,typename TO>
73class ArrayIterator : public cpp::FastIterator_obj<TO>
74{
75public:
76 HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::clsIdArrayIterator };
77
78 ArrayIterator(Array<FROM> inArray) : mArray(inArray), mIdx(0) { }
79
80 // Fast versions ...
81 bool hasNext() HXCPP_OVERRIDE { return mIdx < mArray->length; }
82
83 inline TO toTo(const Dynamic &inD) { return inD.StaticCast<TO>(); }
84
85 template<typename T>
86 inline TO toTo(T inT) { return inT; }
87
88 TO next() HXCPP_OVERRIDE { return toTo(mArray->__get(mIdx++)); }
89
90 void __Mark(hx::MarkContext *__inCtx) HXCPP_OVERRIDE { HX_MARK_MEMBER_NAME(mArray,"mArray"); }
91 #ifdef HXCPP_VISIT_ALLOCS
92 void __Visit(hx::VisitContext *__inCtx) HXCPP_OVERRIDE { HX_VISIT_MEMBER_NAME(mArray,"mArray"); }
93 #endif
94
95 int mIdx;
96 Array<FROM> mArray;
97};
98
99// --- ArrayKeyValueIterator -------------------------------------------
100template<typename FROM,typename TO>

Callers

nothing calls this directly

Calls 1

__getMethod · 0.80

Tested by

no test coverage detected