10#if defined(__unix__) || defined(__APPLE__)
34 template <trivially_destructible T>
37 std::free(
const_cast<std::remove_const_t<T>*
>(p));
43 template<trivially_destructible T>
63 auto const size = std::strlen(str) + 1;
64 auto * copy =
static_cast<char *
>(std::malloc(size));
65 if (copy ==
nullptr)
return {};
66 std::memcpy(copy, str, size);
72#if defined(__unix__) || defined(__APPLE__)
84 void operator()(
void * p)
const noexcept {
92 using mmap_ptr = std::unique_ptr<void,c_munmap>;
100 mmap_ptr make_mmap_ptr(
void * p, std::
size_t size) noexcept {
101 return mmap_ptr(p,c_munmap(size));
Compiler attributes for host code, with shader-safe shared modifiers.
#define native_artificial
[[artificial]].
#define native_inline
inline [[always_inline]]
#define native_noescape
portable __attribute__((noescape))
#define native_nodiscard
C++17 [[nodiscard]].
std::unique_ptr< T, c_free > unique_c_ptr
unique_c_ptr< char const > unique_str
unique_str dup(char const *str) noexcept
#define native_nonnull(...)
portable [[nonnnull(...)]]
#define native_null_terminated_string_arg(x)
The N th argumnt is a null terminated string.
Architecture-tagged vectors, register packs and supporting value types. Native arithmetic follows its...
static void operator()(T *p) noexcept