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