MCPcopy Create free account
hub / github.com/PX4/eigen / conditional_aligned_realloc_new_auto

Function conditional_aligned_realloc_new_auto

Eigen/src/Core/util/Memory.h:390–408  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

388}
389
390template<typename T, bool Align> inline T* conditional_aligned_realloc_new_auto(T* pts, std::size_t new_size, std::size_t old_size)
391{
392 check_size_for_overflow<T>(new_size);
393 check_size_for_overflow<T>(old_size);
394 if(NumTraits<T>::RequireInitialization && (new_size < old_size))
395 destruct_elements_of_array(pts+new_size, old_size-new_size);
396 T *result = reinterpret_cast<T*>(conditional_aligned_realloc<Align>(reinterpret_cast<void*>(pts), sizeof(T)*new_size, sizeof(T)*old_size));
397 if(NumTraits<T>::RequireInitialization && (new_size > old_size))
398 {
399 EIGEN_TRY
400 {
401 construct_elements_of_array(result+old_size, new_size-old_size);
402 }
403 EIGEN_CATCH(...)
404 {
405 conditional_aligned_free<Align>(result);
406 EIGEN_THROW;
407 }
408 }
409 return result;
410}
411

Callers

nothing calls this directly

Calls 2

Tested by

no test coverage detected