24 return index_ != other.index_;
30 return value_[index_];
46template <
typename T,
size_t Size,
class Enable =
void>
50template <
typename T,
size_t Size>
51struct array<T, Size, enable_if_t<Size != 0> >
final {
58 for (
auto it = this->begin(); it != this->end(); ++ it) {
94 template <
typename Func>
95 void each(
const Func& func) {
96 for (
auto& elem : *
this) {
106template<
typename T,
size_t Size>
112template <
typename T,
size_t Size>
113struct array<T, Size, enable_if_t<Size == 0>>
final {
117 array(
const T* (&elems)) { (void)elems; }
119 T
operator[](
size_t index) { ecs_os_abort(); (void)index;
return T(); }
array< T, Size > to_array(const T(&elems)[Size])
Create a flecs::array from a C array.
array_iterator< T > end()
Return an iterator to the end.
array_iterator< T > begin()
Return an iterator to the beginning.
size_t size()
Return the number of elements.
void each(const Func &func)
Invoke a function for each element.
T & operator[](int index)
Element access by int index.
T * ptr()
Return a pointer to the underlying data.
array(const T(&elems)[Size])
Construct from a C array.
array()
Default constructor.
T & operator[](size_t index)
Element access by size_t index.
array()
Default constructor.
size_t size()
Return the number of elements (always 0).
T operator[](size_t index)
Element access (aborts, array is empty).
array_iterator< T > end()
Return an iterator to the end (empty range).
T * ptr()
Return a null pointer (no data).
array_iterator< T > begin()
Return an iterator to the beginning (empty range).
array(const T *(&elems))
Construct from a pointer (no-op).
Iterator for flecs::array.
array_iterator(T *value, int index)
Construct an iterator from a pointer and index.
T & operator*() const
Dereference operator.
bool operator!=(array_iterator const &other) const
Inequality comparison operator.
array_iterator & operator++()
Pre-increment operator.
Array class (primary template, disabled).