10#if defined(__unix__) || defined(__APPLE__)
34 template <trivially_destructible T>
35 hint_inline hint_artificial
37 std::free(
const_cast<std::remove_const_t<T>*
>(p));
43 template<trivially_destructible T>
58 [[nodiscard]] hint_inline hint_artificial
59 hint_nonnull(1) hint_null_terminated_string_arg(1)
61 hint_noescape
char const * str
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__)
83 hint_inline hint_artificial
84 void operator()(
void * p)
const noexcept {
92 using mmap_ptr = std::unique_ptr<void,c_munmap>;
99 hint_inline hint_artificial hint_nonnull(1)
100 mmap_ptr make_mmap_ptr(
void * p, std::
size_t size) noexcept {
101 return mmap_ptr(p,c_munmap(size));
std::unique_ptr< T, c_free > unique_c_ptr
unique_c_ptr< char const > unique_str
unique_str dup(char const *str) noexcept
Architecture-tagged vectors, register packs and supporting value types. Native arithmetic follows its...
static void operator()(T *p) noexcept