[libc-commits] [libc] [libc] Add front() and erase() to FixedVector (PR #213866)

Jeff Bailey via libc-commits libc-commits at lists.llvm.org
Wed Aug 5 01:12:35 PDT 2026


================
@@ -75,6 +85,14 @@ template <typename T, size_t CAPACITY> class FixedVector {
     return true;
   }
 
+  LIBC_INLINE constexpr iterator erase(iterator pos) {
+    LIBC_ASSERT(pos >= begin() && pos < end());
+    for (iterator it = pos; it + 1 != end(); ++it)
+      *it = *(it + 1);
----------------
kaladron wrote:

This may also be good enough:

```c++
static_assert(cpp::is_trivially_copyable_v<T>, "FixedVector elements must be trivially copyable");
```

https://github.com/llvm/llvm-project/pull/213866


More information about the libc-commits mailing list