1 #ifndef __STG_ARRAY_H__
2 #define __STG_ARRAY_H__
4 #include <cstddef> // size_t
9 template <typename T, size_t S>
14 typedef size_t size_type;
16 typedef const T * const_iterator;
20 for (size_type i = 0; i < S; ++i)
21 m_data[i] = value_type();
24 const value_type & operator[](size_type i) const { return m_data[i]; }
25 value_type & operator[](size_type i) { return m_data[i]; }
26 size_type size() const { return S; }
28 iterator begin() { return &m_data[0]; }
29 const_iterator begin() const { return &m_data[0]; }
30 iterator end() { return &m_data[S + 1]; }
31 const_iterator end() const { return &m_data[S + 1]; }
33 const value_type & front() const { return m_data[0]; }
34 value_type & front() { return m_data[0]; }
35 const value_type & back() const { return m_data[S]; }
36 value_type & back() { return m_data[S]; }