]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
common: avoid using std::aligned_storage_t 62991/head
authorKefu Chai <tchaikov@gmail.com>
Sat, 26 Apr 2025 10:06:26 +0000 (18:06 +0800)
committerKefu Chai <tchaikov@gmail.com>
Sat, 26 Apr 2025 10:10:55 +0000 (18:10 +0800)
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 <tchaikov@gmail.com>
src/common/containers.h

index c0aa835445bb646419abba687fe11efd0c3b13fd..a908fb19e3aa636556c1d69b261e73bd166ebc4d 100644 (file)
@@ -56,8 +56,9 @@ namespace ceph::containers {
 template<typename Value, std::size_t InternalCapacity = 0>
 class tiny_vector {
   // NOTE: to avoid false sharing consider aligning to cache line
-  using storage_unit_t = \
-    std::aligned_storage_t<sizeof(Value), alignof(Value)>;
+  struct alignas(Value) storage_unit_t {
+    unsigned char data[sizeof(Value)];
+  };
 
   std::size_t _size = 0;
   storage_unit_t* const data = nullptr;