From 07ac4c3f8b718e1d220c9a871e4f80821c584ee0 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Sat, 26 Apr 2025 18:06:26 +0800 Subject: [PATCH] common: avoid using std::aligned_storage_t std::aligned_storage_t was deprecated in C++23, to be prepared for it, let's use alignas for the same behavior. Signed-off-by: Kefu Chai --- src/common/containers.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/common/containers.h b/src/common/containers.h index c0aa835445b..a908fb19e3a 100644 --- a/src/common/containers.h +++ b/src/common/containers.h @@ -56,8 +56,9 @@ namespace ceph::containers { template class tiny_vector { // NOTE: to avoid false sharing consider aligning to cache line - using storage_unit_t = \ - std::aligned_storage_t; + struct alignas(Value) storage_unit_t { + unsigned char data[sizeof(Value)]; + }; std::size_t _size = 0; storage_unit_t* const data = nullptr; -- 2.39.5