Skip to content

Commit 1eb14d7

Browse files
committed
selectivly use construct_at
1 parent 0673137 commit 1eb14d7

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

include/beman/inplace_vector/inplace_vector.hpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -571,10 +571,13 @@ class inplace_vector : public inplace_vector_base<T, Capacity> {
571571

572572
template <class... Args>
573573
constexpr reference unchecked_emplace_back(Args &&...args) {
574-
// TODO: what is the feature flag for std::construct_at ??
575-
// auto final = std::construct_at(end(), std::forward<Args>(args)...);
576-
// This is just construct_at expanded out.
574+
#ifdef __cpp_constexpr_dynamic_alloc
575+
auto final = std::construct_at(end(), std::forward<Args>(args)...);
576+
#else
577+
// This is just construct_at expanded out, note this is not constexpr
578+
// friendly
577579
auto final = ::new (end()) T(std::forward<Args>(args)...);
580+
#endif
578581
this->change_size(1);
579582
return *final;
580583
};

0 commit comments

Comments
 (0)