Element i counting from this one, as for a raw pointer.
Declared in <cptr/ptr.hpp>
template<class U = T>
requires (!std::is_void_v<U>)
U&
operator[](std::ptrdiff_t i) const noexcept;
Pointer arithmetic ([], +, -, +=, -=, ++, --) lets ptr serve as an allocator's pointer type for containers that index into blocks of elements. It works on the compressed offset directly, so it costs the same as raw pointer arithmetic, but a loop over an array does not vectorise: convert to T* with get() for hot loops. In a shifted cage, sizeof(T) must be a multiple of the granularity.
| Name | Description |
|---|---|
| i | The right operand |