12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- #ifndef ARRAY_H
- #define ARRAY_H
- #include "common/utils/Types.h"
- template<typename T, u64 N>
- class Array final {
- public:
- Array(const T& t) {
- for(u64 i = 0; i < N; i++) {
- data[i] = t;
- }
- }
- const T& operator[](u64 index) const {
- return data[index];
- }
- T& operator[](u64 index) {
- return data[index];
- }
- const T* operator+(u64 index) const {
- return data + index;
- }
- T* operator+(u64 index) {
- return data + index;
- }
- T* begin() {
- return data;
- }
- const T* begin() const {
- return data;
- }
- T* end() {
- return data + N;
- }
- const T* end() const {
- return data + N;
- }
- private:
- T data[N];
- };
- #endif
|