Skip to content

Commit

Permalink
in place construction
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilipDeegan committed Nov 25, 2024
1 parent b118ce0 commit 690f139
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion inc/mkn/gpu/alloc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ class NoConstructAllocator : public MknGPUAllocator<T, alignment> {
};

template <typename U, typename... Args>
void construct(U* /*ptr*/, Args&&... /*args*/) {} // nothing
void construct(U* ptr, Args&&... args) {
::new ((void*)ptr) U(std::forward<Args>(args)...);
}
template <typename U>
void construct(U* /*ptr*/) noexcept(std::is_nothrow_default_constructible<U>::value) {}
};
Expand Down

0 comments on commit 690f139

Please sign in to comment.