[libcxx-commits] [libcxx] [libc++] Remove some of the uses of aligned_storage inside the library (PR #161635)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Wed Oct 8 09:02:39 PDT 2025


================
@@ -148,14 +147,13 @@ template <class _ValueType>
 _LIBCPP_HIDE_FROM_ABI add_pointer_t<_ValueType> any_cast(any*) _NOEXCEPT;
 
 namespace __any_imp {
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
-using _Buffer _LIBCPP_NODEBUG = aligned_storage_t<3 * sizeof(void*), alignof(void*)>;
-_LIBCPP_SUPPRESS_DEPRECATED_POP
+inline constexpr size_t __small_buffer_size      = 3 * sizeof(void*);
----------------
ldionne wrote:

I found the previous code easier to read since we did `sizeof(_Buffer)` and `alignof(_Buffer)` below. What would you think of `using _Buffer = alignas(alignment) char [size]` instead?

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


More information about the libcxx-commits mailing list