From 2e1882725976a2b8fb0c606cad1381a293f2a4bd Mon Sep 17 00:00:00 2001 From: Francisco Date: Sun, 14 Mar 2021 13:17:14 +0000 Subject: [PATCH] avoid accessing C-array via &[0] for initialized buffer --- lib/include/srslte/adt/bounded_vector.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/include/srslte/adt/bounded_vector.h b/lib/include/srslte/adt/bounded_vector.h index eba3015a5..d940347c7 100644 --- a/lib/include/srslte/adt/bounded_vector.h +++ b/lib/include/srslte/adt/bounded_vector.h @@ -107,13 +107,13 @@ public: } T& front() { return (*this)[0]; } const T& front() const { return (*this)[0]; } - T* data() { return reinterpret_cast(&buffer[0]); } - const T* data() const { return reinterpret_cast(&buffer[0]); } + T* data() { return &front(); } + const T* data() const { return &front(); } // Iterators - iterator begin() { return data(); } + iterator begin() { return reinterpret_cast(buffer); } iterator end() { return begin() + size_; } - const_iterator begin() const { return data(); } + const_iterator begin() const { return reinterpret_cast(buffer); } const_iterator end() const { return begin() + size_; } // Capacity