mirror of
https://github.com/libretro/devilutionX.git
synced 2026-11-10 02:41:39 -10:00
This version of NDK finally comes with updated libc++. The last update to libc++ in NDK was in early 2020. This update brings lots of improvements and bugfixes from upstream libc++. NDK 26 only support SDK 21+, so we bump `minSdkVersion` as well.
30 lines
759 B
C++
30 lines
759 B
C++
#pragma once
|
|
|
|
#include <cstddef>
|
|
#include <memory>
|
|
|
|
namespace devilution {
|
|
|
|
// Apple Clang 12 has a buggy implementation that fails to compile `std::shared_ptr<T[]>(new T[size])`.
|
|
#if (__cplusplus >= 201611L && (!defined(__clang_major__) || __clang_major__ >= 13)) && !defined(NXDK)
|
|
template <typename T>
|
|
using ArraySharedPtr = std::shared_ptr<T[]>;
|
|
|
|
template <typename T>
|
|
ArraySharedPtr<T> MakeArraySharedPtr(std::size_t size)
|
|
{
|
|
return ArraySharedPtr<T>(new T[size]);
|
|
}
|
|
#else
|
|
template <typename T>
|
|
using ArraySharedPtr = std::shared_ptr<T>;
|
|
|
|
template <typename T>
|
|
ArraySharedPtr<T> MakeArraySharedPtr(std::size_t size)
|
|
{
|
|
return ArraySharedPtr<T> { new T[size], std::default_delete<T[]>() };
|
|
}
|
|
#endif
|
|
|
|
} // namespace devilution
|