26 lines
515 B
C
26 lines
515 B
C
|
#ifndef RANDOMITERATOR_H
|
||
|
#define RANDOMITERATOR_H
|
||
|
|
||
|
#include "Object.h"
|
||
|
|
||
|
namespace Kylin {
|
||
|
|
||
|
template <typename T>
|
||
|
class RandomIterator : public Object {
|
||
|
public:
|
||
|
RandomIterator(T *pos) : m_pos(pos) {}
|
||
|
T &operator*() { return *m_pos; }
|
||
|
RandomIterator &operator++() {
|
||
|
m_pos++;
|
||
|
return *this;
|
||
|
}
|
||
|
bool operator!=(const RandomIterator &other) { return m_pos != other.m_pos; }
|
||
|
|
||
|
private:
|
||
|
T *m_pos = nullptr;
|
||
|
};
|
||
|
|
||
|
} // namespace Kylin
|
||
|
|
||
|
#endif // RANDOMITERATOR_H
|