Merge pull request #340 from eoan-ermine/issue/338

Replace std::aligned_storage<T, ...> with alignas(T) unsigned char[]
This commit is contained in:
Oliver Kowalke
2026-06-02 19:36:40 +02:00
committed by GitHub
3 changed files with 8 additions and 8 deletions
+3 -3
View File
@@ -356,10 +356,10 @@ public:
class iterator {
private:
typedef typename std::aligned_storage< sizeof( value_type), alignof( value_type) >::type storage_type;
typedef unsigned char storage_type[sizeof(value_type)];
buffered_channel * chan_{ nullptr };
storage_type storage_;
buffered_channel * chan_{ nullptr };
alignas(value_type) storage_type storage_;
void increment_( bool initial = false) {
BOOST_ASSERT( nullptr != chan_);
+3 -3
View File
@@ -392,10 +392,10 @@ public:
class iterator {
private:
typedef typename std::aligned_storage< sizeof( value_type), alignof( value_type) >::type storage_type;
typedef unsigned char storage_type[sizeof(value_type)];
unbuffered_channel * chan_{ nullptr };
storage_type storage_;
unbuffered_channel * chan_{ nullptr };
alignas(value_type) storage_type storage_;
void increment_( bool initial = false) {
BOOST_ASSERT( nullptr != chan_);
+2 -2
View File
@@ -38,11 +38,11 @@ public:
typedef T value_type;
private:
typedef typename std::aligned_storage< sizeof( T), alignof( T) >::type storage_type;
typedef unsigned char storage_type[sizeof(T)];
struct alignas(cache_alignment) slot {
std::atomic< std::size_t > cycle{ 0 };
storage_type storage{};
alignas(T) storage_type storage{};
slot() = default;
};