Set default supported C++ standard version to C++23
Fix deprecation of std::aligned_storage
This commit is contained in:
parent
ce5531dbbb
commit
17be2f3aaa
3 changed files with 6 additions and 8 deletions
|
|
@ -3,7 +3,7 @@ project(psemek)
|
||||||
|
|
||||||
cmake_policy(SET CMP0077 NEW)
|
cmake_policy(SET CMP0077 NEW)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 20)
|
set(CMAKE_CXX_STANDARD 23)
|
||||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
|
||||||
|
|
||||||
string(TOUPPER "${CMAKE_BUILD_TYPE}" PSEMEK_BUILD_TYPE)
|
string(TOUPPER "${CMAKE_BUILD_TYPE}" PSEMEK_BUILD_TYPE)
|
||||||
|
|
|
||||||
|
|
@ -23,8 +23,8 @@ namespace psemek::util
|
||||||
struct function<R(Args...)>
|
struct function<R(Args...)>
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
static constexpr std::size_t storage_size = sizeof(void*) * 3;
|
static constexpr std::size_t storage_size = sizeof(void *) * 3;
|
||||||
static constexpr std::size_t storage_align = alignof(void*);
|
static constexpr std::size_t storage_align = alignof(void *);
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct uses_static_storage
|
struct uses_static_storage
|
||||||
|
|
@ -81,7 +81,7 @@ namespace psemek::util
|
||||||
void swap(function & other) noexcept;
|
void swap(function & other) noexcept;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::aligned_storage_t<storage_size, storage_align> storage_;
|
alignas(storage_align) std::byte storage_[storage_size];
|
||||||
|
|
||||||
struct vtable
|
struct vtable
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <type_traits>
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#define psemek_declare_pimpl \
|
#define psemek_declare_pimpl \
|
||||||
|
|
@ -23,7 +22,7 @@ namespace psemek::util::pimpl
|
||||||
template <typename Parent>
|
template <typename Parent>
|
||||||
struct impl;
|
struct impl;
|
||||||
|
|
||||||
template <typename Parent, std::size_t Size>
|
template <typename Parent, std::size_t Size, std::size_t Align = alignof(std::max_align_t)>
|
||||||
struct in_place
|
struct in_place
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
|
@ -49,8 +48,7 @@ namespace psemek::util::pimpl
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
alignas(Align) std::byte storage_[Size];
|
||||||
typename std::aligned_storage<Size>::type storage_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename Parent>
|
template <typename Parent>
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue