commit 2d5711228631639e10e2db6a35305a6b84aec33a
parent 65630d48449224e750ee6b047fa492c55f2cb6bc
Author: Morel Bérenger <berengermorel76@gmail.com>
Date:   Fri, 14 Aug 2020 06:45:10 +0200
fix vector.hpp
* include <new>, which should probably be avoided
* make vector<> final and remove the vtable
Diffstat:
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/btl/src/vector.hpp b/btl/src/vector.hpp
@@ -7,12 +7,17 @@
 #include <stdio.h>
 #endif
 
+//this could *highly* probably be replaced with:
+//void* new( void* p ) { return p; }
+#include <new>
+
 //methods return true on error
 //public API should rely as much as possible on private API:
 //no need to pile useless calls: this just makes debug harder
 //code should never throw
+//The class is marked final to avoid useless vtable.
 template <typename T>
-class vector
+class vector final
 {
 	T* m_data = nullptr;
 	size_t m_size = 0;
@@ -45,7 +50,7 @@ public:
 	vector( vector<T> && );
 	vector<T>& operator=( vector<T> && );
 	//destructor
-	virtual ~vector( void );
+	~vector( void );
 
 	T const* begin( void ) const;
 	T * begin( void );