| 915 | /// The collection iterator. |
| 916 | /// </summary> |
| 917 | struct Iterator |
| 918 | { |
| 919 | friend Array; |
| 920 | private: |
| 921 | Array* _array; |
| 922 | int32 _index; |
| 923 | |
| 924 | Iterator(Array* array, const int32 index) |
| 925 | : _array(array) |
| 926 | , _index(index) |
| 927 | { |
| 928 | } |
| 929 | |
| 930 | Iterator(const Array* array, const int32 index) |
| 931 | : _array(const_cast<Array*>(array)) |
| 932 | , _index(index) |
| 933 | { |
| 934 | } |
| 935 | |
| 936 | public: |
| 937 | Iterator() |
| 938 | : _array(nullptr) |
| 939 | , _index(-1) |
| 940 | { |
| 941 | } |
| 942 | |
| 943 | Iterator(const Iterator& i) |
| 944 | : _array(i._array) |
| 945 | , _index(i._index) |
| 946 | { |
| 947 | } |
| 948 | |
| 949 | Iterator(Iterator&& i) |
| 950 | : _array(i._array) |
| 951 | , _index(i._index) |
| 952 | { |
| 953 | } |
| 954 | |
| 955 | public: |
| 956 | FORCE_INLINE Array* GetArray() const |
| 957 | { |
| 958 | return _array; |
| 959 | } |
| 960 | |
| 961 | FORCE_INLINE int32 GetIndex() const |
| 962 | { |
| 963 | return _index; |
| 964 | } |
| 965 | |
| 966 | FORCE_INLINE bool IsEnd() const |
| 967 | { |
| 968 | return _index == _array->_count; |
| 969 | } |
| 970 | |
| 971 | FORCE_INLINE bool IsNotEnd() const |
| 972 | { |
| 973 | return _index != _array->_count; |
| 974 | } |