Skip to content

Commit 795c8b3

Browse files
rprichardGerrit Code Review
authored andcommitted
Merge "ftl: delegate SmallVector<const T> to std::vector<T>" into main
2 parents 5a74561 + 2b2abd3 commit 795c8b3

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

include/ftl/small_vector.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ class SmallVector final : details::ArrayTraits<T>, details::ArrayComparators<Sma
234234
}
235235

236236
// Extracts the elements as std::vector.
237-
std::vector<T> promote() && {
237+
std::vector<std::remove_const_t<T>> promote() && {
238238
if (dynamic()) {
239239
return std::get<Dynamic>(std::move(vector_)).promote();
240240
} else {
@@ -290,11 +290,11 @@ template <typename T>
290290
class SmallVector<T, 0> final : details::ArrayTraits<T>,
291291
details::ArrayComparators<SmallVector>,
292292
details::ArrayIterators<SmallVector<T, 0>, T>,
293-
std::vector<T> {
293+
std::vector<std::remove_const_t<T>> {
294294
using details::ArrayTraits<T>::replace_at;
295295

296296
using Iter = details::ArrayIterators<SmallVector, T>;
297-
using Impl = std::vector<T>;
297+
using Impl = std::vector<std::remove_const_t<T>>;
298298

299299
friend Iter;
300300

@@ -394,12 +394,12 @@ class SmallVector<T, 0> final : details::ArrayTraits<T>,
394394
pop_back();
395395
}
396396

397-
std::vector<T> promote() && { return std::move(*this); }
397+
std::vector<std::remove_const_t<T>> promote() && { return std::move(*this); }
398398

399399
private:
400400
template <typename U, std::size_t M>
401401
static Impl convert(SmallVector<U, M>&& other) {
402-
if constexpr (std::is_constructible_v<Impl, std::vector<U>&&>) {
402+
if constexpr (std::is_constructible_v<Impl, std::vector<std::remove_const_t<U>>&&>) {
403403
return std::move(other).promote();
404404
} else {
405405
SmallVector vector(other.size());

0 commit comments

Comments
 (0)