Class array< T, Size, enable_if_t< Size !=0 > >

Synopsis

#include <include/flecs/addons/cpp/util.hpp>

template <typename T, size_t Size>
class array<T, Size, enable_if_t<Size != 0> >

Description

No description yet.

Methods

array overload
begin
end
operator[]
ptr
size

Source

Lines 315-348 in include/flecs/addons/cpp/util.hpp.

template <typename T, size_t Size>
class array<T, Size, enable_if_t<Size != 0> > {
public:
    array() {};

    array(const T (&elems)[Size]) {
        int i = 0;
        for (auto it = this->begin(); it != this->end(); ++ it) {
            *it = elems[i ++];
        }
    }

    T& operator[](size_t index) {
        return m_array[index];
    }

    array_iterator<T> begin() {
        return array_iterator<T>(m_array, 0);
    }

    array_iterator<T> end() {
        return array_iterator<T>(m_array, Size);
    }

    size_t size() {
        return Size;
    }

    T* ptr() {
        return m_array;
    }
private:
    T m_array[Size];
};