| 17 | |
| 18 | template <typename T, std::size_t N> |
| 19 | struct array |
| 20 | { |
| 21 | using value_type = T; |
| 22 | |
| 23 | constexpr std::size_t size() const |
| 24 | { |
| 25 | return N; |
| 26 | } |
| 27 | |
| 28 | constexpr bool empty() const |
| 29 | { |
| 30 | return size() == 0; |
| 31 | } |
| 32 | |
| 33 | constexpr const T* begin() const |
| 34 | { |
| 35 | return &data[0]; |
| 36 | } |
| 37 | |
| 38 | cfg_constexpr14 T* begin() |
| 39 | { |
| 40 | return &data[0]; |
| 41 | } |
| 42 | |
| 43 | constexpr const T* cbegin() const |
| 44 | { |
| 45 | return begin(); |
| 46 | } |
| 47 | |
| 48 | constexpr const T* end() const |
| 49 | { |
| 50 | return &data[N]; |
| 51 | } |
| 52 | |
| 53 | cfg_constexpr14 T* end() |
| 54 | { |
| 55 | return &data[N]; |
| 56 | } |
| 57 | |
| 58 | constexpr const T* cend() const |
| 59 | { |
| 60 | return end(); |
| 61 | } |
| 62 | |
| 63 | constexpr const T& operator[](std::size_t pos) const |
| 64 | { |
| 65 | return data[pos]; |
| 66 | } |
| 67 | |
| 68 | cfg_constexpr14 T& operator[](std::size_t pos) |
| 69 | { |
| 70 | return data[pos]; |
| 71 | } |
| 72 | |
| 73 | constexpr const T& at(std::size_t pos) const |
| 74 | { |
| 75 | return pos < size() ? data[pos] : throw std::out_of_range("The given position is out of range"); |
| 76 | } |
no test coverage detected