1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| template <typename T, std::size_t N> class ArrayResult { constexpr static std::size_t size_ = N; T data_[N] {}; public: constexpr std::size_t size() const { return N; } constexpr T& operator[](std::size_t n) { return data_[n]; } constexpr const T& operator[](std::size_t n) const { return data_[n]; } using iterator = T*; using const_iterator = const T*; constexpr iterator begin() { return &data_[0]; } constexpr const_iterator begin() const { return &data_[0]; } constexpr iterator end() { return &data_[N]; } constexpr const_iterator end() const { return &data_[N]; } };
|