18#if !defined(__MINGW32__)
19typedef SSIZE_T ssize_t;
31#elif defined(__GNUC__)
33#elif defined(_MSC_VER)
36#error "Compiler not supported."
43#elif defined(__FreeBSD__)
45#elif defined(__APPLE__)
48#error "Target not supported."
51#if defined(OS_LINUX) || defined(OS_FREEBSD) || defined(OS_DARWIN)
58#elif defined(__ANDROID__)
59#define PLATFORM_ANDROID
61#elif defined(OS_WIN32)
62#if defined(__MINGW32__)
67#if defined(__arm__) || defined(_M_ARM)
70#elif defined(__aarch64__) || defined(_M_ARM64)
73#elif defined(__i386__) || defined(_M_IX86)
76#elif defined(__x86_64__) || defined(_M_AMD64)
83#elif __riscv_xlen == 64
85#elif __riscv_xlen == 128
89#error "Architecture not supported."
92#if defined(COMPILER_MSVC)
95#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
97#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
99#elif __BYTE_ORDER__ == __ORDER_PDP_ENDIAN__
102#error "Unknown endianness."
119typename std::enable_if<
120 !std::is_pointer<T>::value && std::is_pod<T>::value,
121 size_t>::type
static inline constexpr array_sizeof(T
const &array) {
122 return sizeof(array) / (
reinterpret_cast<uintptr_t
>(&array[1]) -
123 reinterpret_cast<uintptr_t
>(&array[0]));
129template <
typename T,
typename... Args>
130std::unique_ptr<T> make_unique(Args &&... args) {
131 return std::unique_ptr<T>(
new T(std::forward<Args>(args)...));
140 template <
typename... Args>
144 template <
typename... Args>
145 static std::unique_ptr<T> make_protected_unique(Args... args) {
146 return ds2::make_unique<make_unique_enabler_helper>(
147 std::forward<Args>(args)...);