Reimplement (C++23) deprecated std::aligned_storage (#2680)

Use boost::aligned_storage instead of std::.

The latter is deprecated in C++23.

---------

Co-authored-by: Ed Catmur <edward.catmur@mavensecurities.com>
This commit is contained in:
Ed Catmur
2023-05-15 02:03:10 +01:00
committed by GitHub
parent cd6b79db5a
commit a23e24ffee
2 changed files with 4 additions and 2 deletions

View File

@@ -10,6 +10,7 @@
#ifndef BOOST_BEAST_DETAIL_TYPE_TRAITS_HPP
#define BOOST_BEAST_DETAIL_TYPE_TRAITS_HPP
#include <boost/type_traits/aligned_storage.hpp>
#include <boost/type_traits/make_void.hpp>
#include <type_traits>
#include <new>
@@ -64,7 +65,7 @@ struct aligned_union
std::size_t constexpr alignment_value =
max_alignof<Ts...>();
using type = typename std::aligned_storage<
using type = typename boost::aligned_storage<
(Len > max_sizeof<Ts...>()) ? Len : (max_sizeof<Ts...>()),
alignment_value>::type;
};

View File

@@ -12,6 +12,7 @@
#include <boost/beast/websocket/rfc6455.hpp>
#include <boost/core/exchange.hpp>
#include <boost/type_traits/aligned_storage.hpp>
#include <boost/type_traits/make_void.hpp>
#include <algorithm>
#include <memory>
@@ -62,7 +63,7 @@ class decorator
{
void* p_;
void (*fn_)();
typename std::aligned_storage<
typename boost::aligned_storage<
sizeof(exemplar),
alignof(exemplar)>::type buf_;
};