10 using difference_type = std::ptrdiff_t;
12 using pointer = value_type*;
13 using reference = value_type&;
14 using iterator_category = std::random_access_iterator_tag;
16 [[nodiscard]]
constexpr ContainerIterator(T* container,
int position) : mContainer(container), mSlot(position) {}
19 return mSlot == other.mSlot && mContainer == other.mContainer;
21 [[nodiscard]]
constexpr std::strong_ordering operator<=>(
const ContainerIterator& other)
const {
22 return mSlot <=> other.mSlot;
24 [[nodiscard]]
constexpr reference operator*()
const {
25 if constexpr (std::is_const_v<T>) {
26 return mContainer->getItem(mSlot);
28 return mContainer->getItemNonConst(mSlot);
31 [[nodiscard]]
constexpr pointer operator->()
const {
32 if constexpr (std::is_const_v<T>) {
33 return &mContainer->getItem(mSlot);
35 return mContainer->getItemNonConst(mSlot);
60 [[nodiscard]]
constexpr reference operator[](difference_type n)
const {
return *(*
this + n); }