commit 9a785114268b2bbfd559a60705561b78864870f1
parent 9c4e915295a30696aa211c2419d715a48082dbc7
Author: Morel BĂ©renger <berengermorel76@gmail.com>
Date: Sat, 30 May 2020 02:19:30 +0200
fix implicit cast in vector
Diffstat:
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/vector.hpp b/vector.hpp
@@ -133,7 +133,12 @@ bool vector<T>::resize( size_t size )
template <typename T>
bool vector<T>::assign( iterator start, iterator end )
{
- size_t new_size = end - start;
+ if( end - start < 0 )
+ {
+ return true;
+ }
+ size_t new_size = static_cast<size_t>( end - start );
+
release( new_size );
if( allocate( new_size ) )
{