[libcxx-commits] [libcxx] [libc++] Add the __is_replaceable type trait (PR #132408)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Mon Mar 24 11:28:10 PDT 2025


================
@@ -120,6 +121,10 @@ class _LIBCPP_TEMPLATE_VIS vector {
       __libcpp_is_trivially_relocatable<pointer>::value && __libcpp_is_trivially_relocatable<allocator_type>::value,
       vector,
       void>;
+  using __replaceable _LIBCPP_NODEBUG =
+      __conditional_t<__is_replaceable<pointer>::value && __container_allocator_is_replaceable<__alloc_traits>::value,
+                      vector,
+                      void>;
----------------
ldionne wrote:

That's a good question. We have a forward declaration of `vector<bool>` inside `__fwd/vector.h`, so the base template definition in `vector.h` doesn't count for `vector<bool>`. It should be a compiler error if you try to use `vector<bool>` without having included it. For example: https://godbolt.org/z/GT5zePY97

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


More information about the libcxx-commits mailing list