mirror of
https://github.com/slint-ui/slint.git
synced 2025-11-01 04:18:14 +00:00
Fix build against macOS deployment target 10.10
- std::optional<T>::value() is not available, use operator * instead - alignment allocation is also only available in 10.14 or newer
This commit is contained in:
parent
18253b5150
commit
0ba6ef1c24
4 changed files with 14 additions and 4 deletions
|
|
@ -9,6 +9,10 @@
|
|||
#include <optional>
|
||||
#include <atomic>
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <AvailabilityMacros.h>
|
||||
#endif
|
||||
|
||||
namespace vtable {
|
||||
|
||||
template<typename T>
|
||||
|
|
@ -119,8 +123,12 @@ public:
|
|||
template<typename... Args>
|
||||
static VRc make(Args... args)
|
||||
{
|
||||
#if !defined(__APPLE__) || MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_14
|
||||
auto mem = ::operator new(sizeof(VRcInner<VTable, X>),
|
||||
static_cast<std::align_val_t>(alignof(VRcInner<VTable, X>)));
|
||||
#else
|
||||
auto mem = ::operator new(sizeof(VRcInner<VTable, X>));
|
||||
#endif
|
||||
auto inner = new (mem) VRcInner<VTable, X>;
|
||||
new (&inner->data) X(args...);
|
||||
return VRc(inner);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue