From a31cae151d7e99f34f4323b002ff44df9eaa2e47 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Sun, 13 Sep 2015 21:13:53 +0100 Subject: [PATCH] Fixed serious error where etl::vector would always allocate N^2 storage instead of N. --- vector.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/vector.h b/vector.h index 4575fdeb..fd679dee 100644 --- a/vector.h +++ b/vector.h @@ -64,7 +64,7 @@ namespace etl /// Constructor. //************************************************************************* vector() - : ivector(reinterpret_cast(&buffer[0]), MAX_SIZE) + : ivector(reinterpret_cast(&buffer), MAX_SIZE) { } @@ -73,7 +73,7 @@ namespace etl ///\param initialSize The initial size of the vector. //************************************************************************* explicit vector(size_t initialSize) - : ivector(reinterpret_cast(&buffer[0]), MAX_SIZE) + : ivector(reinterpret_cast(&buffer), MAX_SIZE) { ivector::resize(initialSize); } @@ -84,7 +84,7 @@ namespace etl ///\param value The value to fill the vector with. //************************************************************************* vector(size_t initialSize, typename ivector::parameter_t value) - : ivector(reinterpret_cast(&buffer[0]), MAX_SIZE) + : ivector(reinterpret_cast(&buffer), MAX_SIZE) { ivector::resize(initialSize, value); } @@ -97,7 +97,7 @@ namespace etl //************************************************************************* template vector(TIterator first, TIterator last) - : ivector(reinterpret_cast(&buffer[0]), MAX_SIZE) + : ivector(reinterpret_cast(&buffer), MAX_SIZE) { ivector::assign(first, last); } @@ -117,7 +117,7 @@ namespace etl private: - typename etl::aligned_storage::value>::type buffer[MAX_SIZE]; + typename etl::aligned_storage::value>::type buffer; }; }