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

Function conditional_aligned_realloc_new

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

Source from the content-addressed store, hash-verified

344}
345
346template<typename T, bool Align> EIGEN_DEVICE_FUNC inline T* conditional_aligned_realloc_new(T* pts, std::size_t new_size, std::size_t old_size)
347{
348 check_size_for_overflow<T>(new_size);
349 check_size_for_overflow<T>(old_size);
350 if(new_size < old_size)
351 destruct_elements_of_array(pts+new_size, old_size-new_size);
352 T *result = reinterpret_cast<T*>(conditional_aligned_realloc<Align>(reinterpret_cast<void*>(pts), sizeof(T)*new_size, sizeof(T)*old_size));
353 if(new_size > old_size)
354 {
355 EIGEN_TRY
356 {
357 construct_elements_of_array(result+old_size, new_size-old_size);
358 }
359 EIGEN_CATCH(...)
360 {
361 conditional_aligned_free<Align>(result);
362 EIGEN_THROW;
363 }
364 }
365 return result;
366}
367

Callers

nothing calls this directly

Calls 2

Tested by

no test coverage detected