Skip to content

Commit

Permalink
selectivly use construct_at
Browse files Browse the repository at this point in the history
  • Loading branch information
wusatosi committed Nov 18, 2024
1 parent 0673137 commit 1eb14d7
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions include/beman/inplace_vector/inplace_vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -571,10 +571,13 @@ class inplace_vector : public inplace_vector_base<T, Capacity> {

template <class... Args>
constexpr reference unchecked_emplace_back(Args &&...args) {
// TODO: what is the feature flag for std::construct_at ??
// auto final = std::construct_at(end(), std::forward<Args>(args)...);
// This is just construct_at expanded out.
#ifdef __cpp_constexpr_dynamic_alloc
auto final = std::construct_at(end(), std::forward<Args>(args)...);
#else
// This is just construct_at expanded out, note this is not constexpr
// friendly
auto final = ::new (end()) T(std::forward<Args>(args)...);
#endif
this->change_size(1);
return *final;
};
Expand Down

0 comments on commit 1eb14d7

Please sign in to comment.