avoid accessing C-array via &[0] for initialized buffer

master
Francisco 4 years ago committed by Francisco Paisana
parent 80104c7e65
commit 2e18827259

@ -107,13 +107,13 @@ public:
}
T& front() { return (*this)[0]; }
const T& front() const { return (*this)[0]; }
T* data() { return reinterpret_cast<T*>(&buffer[0]); }
const T* data() const { return reinterpret_cast<const T*>(&buffer[0]); }
T* data() { return &front(); }
const T* data() const { return &front(); }
// Iterators
iterator begin() { return data(); }
iterator begin() { return reinterpret_cast<T*>(buffer); }
iterator end() { return begin() + size_; }
const_iterator begin() const { return data(); }
const_iterator begin() const { return reinterpret_cast<const T*>(buffer); }
const_iterator end() const { return begin() + size_; }
// Capacity

Loading…
Cancel
Save