fix ei_aligned_delete for null pointers and non trivial dtors

This commit is contained in:
Gael Guennebaud 2010-07-14 22:49:34 +02:00
parent 19a70ae939
commit 90d6fc0e28

View File

@ -315,7 +315,8 @@ template<typename T> inline T* ei_construct_elements_of_array(T *ptr, size_t siz
template<typename T> inline void ei_destruct_elements_of_array(T *ptr, size_t size)
{
// always destruct an array starting from the end.
while(size) ptr[--size].~T();
if(ptr)
while(size) ptr[--size].~T();
}
/*****************************************************************************