World of Might and Magic  0.2.0
Open reimplementation of Might and Magic 6 7 8 game engine
NZIArray.h
См. документацию.
1 #pragma once
2 
3 #include <array>
4 #include <cassert>
5 
6 template <class _Ty, size_t _Size>
7 class NZIArray : std::array<_Ty, _Size> {
8  public:
9  _Ty& ZerothIndex() { return std::array<_Ty, _Size>::operator[](0); }
10 
11  _Ty& operator[](size_t _Pos) { // subscript nonmutable sequence
12  assert(_Pos != 0 && "not allowed to access zeroth element");
13  return std::array<_Ty, _Size>::operator[](_Pos);
14  }
15 
16  const _Ty& operator[](size_t _Pos) const { // subscript nonmutable sequence
17  assert(_Pos != 0 && "not allowed to access zeroth element");
18  return std::array<_Ty, _Size>::operator[](_Pos);
19  }
20 };
NZIArray::ZerothIndex
_Ty & ZerothIndex()
Definition: NZIArray.h:9
NZIArray
Definition: NZIArray.h:7
NZIArray::operator[]
const _Ty & operator[](size_t _Pos) const
Definition: NZIArray.h:16
NZIArray::operator[]
_Ty & operator[](size_t _Pos)
Definition: NZIArray.h:11
array
GLenum array
Definition: SDL_opengl_glext.h:6303