| 367 | |
| 368 | |
| 369 | template<typename T, bool Align> EIGEN_DEVICE_FUNC inline T* conditional_aligned_new_auto(std::size_t size) |
| 370 | { |
| 371 | if(size==0) |
| 372 | return 0; // short-cut. Also fixes Bug 884 |
| 373 | check_size_for_overflow<T>(size); |
| 374 | T *result = reinterpret_cast<T*>(conditional_aligned_malloc<Align>(sizeof(T)*size)); |
| 375 | if(NumTraits<T>::RequireInitialization) |
| 376 | { |
| 377 | EIGEN_TRY |
| 378 | { |
| 379 | construct_elements_of_array(result, size); |
| 380 | } |
| 381 | EIGEN_CATCH(...) |
| 382 | { |
| 383 | conditional_aligned_free<Align>(result); |
| 384 | EIGEN_THROW; |
| 385 | } |
| 386 | } |
| 387 | return result; |
| 388 | } |
| 389 |
nothing calls this directly
no test coverage detected