Skip to content

Commit

Permalink
Rewrite aligning new to please MSVC
Browse files Browse the repository at this point in the history
MSVC was complaining about the previous form with:
error C2956: usual deallocation function 'void operator delete[](void *,std::align_val_t) noexcept' would be chosen as placement deallocation function.
  • Loading branch information
bernhardmgruber committed Jan 17, 2024
1 parent fbb93ba commit 0bad022
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion examples/nbody_code_comp/nbody-SoA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ struct AlignedAllocator {
using value_type = T;

auto allocate(std::size_t n) const -> T* {
return new(std::align_val_t{64}) T[n];
return static_cast<T*>(::operator new[](n * sizeof(T), std::align_val_t{64}));
}

void deallocate(T* p, std::size_t) const {
Expand Down

0 comments on commit 0bad022

Please sign in to comment.