@@ -25,45 +25,45 @@ template <typename T, size_t CAPACITY> class FixedVector {
2525 constexpr FixedVector () = default;
2626
2727 using iterator = typename cpp::array<T, CAPACITY>::iterator;
28- constexpr FixedVector (iterator begin, iterator end) {
28+ constexpr FixedVector (iterator begin, iterator end) : store{}, item_count{} {
2929 for (; begin != end; ++begin)
3030 push_back (*begin);
3131 }
3232
33- constexpr FixedVector (size_t count, const T &value) {
33+ constexpr FixedVector (size_t count, const T &value) : store{}, item_count{} {
3434 for (size_t i = 0 ; i < count; ++i)
3535 push_back (value);
3636 }
3737
38- bool push_back (const T &obj) {
38+ constexpr bool push_back (const T &obj) {
3939 if (item_count == CAPACITY)
4040 return false ;
4141 store[item_count] = obj;
4242 ++item_count;
4343 return true ;
4444 }
4545
46- const T &back () const { return store[item_count - 1 ]; }
46+ constexpr const T &back () const { return store[item_count - 1 ]; }
4747
48- T &back () { return store[item_count - 1 ]; }
48+ constexpr T &back () { return store[item_count - 1 ]; }
4949
50- bool pop_back () {
50+ constexpr bool pop_back () {
5151 if (item_count == 0 )
5252 return false ;
5353 --item_count;
5454 return true ;
5555 }
5656
57- T &operator [](size_t idx) { return store[idx]; }
57+ constexpr T &operator [](size_t idx) { return store[idx]; }
5858
59- const T &operator [](size_t idx) const { return store[idx]; }
59+ constexpr const T &operator [](size_t idx) const { return store[idx]; }
6060
61- bool empty () const { return item_count == 0 ; }
61+ constexpr bool empty () const { return item_count == 0 ; }
6262
63- size_t size () const { return item_count; }
63+ constexpr size_t size () const { return item_count; }
6464
6565 // Empties the store for all practical purposes.
66- void reset () { item_count = 0 ; }
66+ constexpr void reset () { item_count = 0 ; }
6767
6868 // This static method does not free up the resources held by |store|,
6969 // say by calling `free` or something similar. It just does the equivalent
0 commit comments