<!--
{
  "availability" : [
    "DriverKit: -",
    "iOS: -",
    "iPadOS: -",
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "DriverKit",
  "identifier" : "/documentation/DriverKit/libkern",
  "metadataVersion" : "0.1.0",
  "role" : "Namespace",
  "symbol" : {
    "kind" : "Namespace",
    "modules" : [
      "DriverKit"
    ],
    "preciseIdentifier" : "c:@N@libkern"
  },
  "title" : "libkern"
}
-->

# libkern

```
namespace libkern;
```

## Topics

### Namespaces

[`namespace bar_detail;`](/documentation/DriverKit/libkern/bar_detail)

[`namespace detail;`](/documentation/DriverKit/libkern/detail)

[`namespace sa_detail;`](/documentation/DriverKit/libkern/sa_detail)

### Structures

[`struct adopt_memory_t;`](/documentation/DriverKit/libkern/adopt_memory_t)

[`struct allocate_memory_t;`](/documentation/DriverKit/libkern/allocate_memory_t)

[`struct allocate_memory_zero_t;`](/documentation/DriverKit/libkern/allocate_memory_zero_t)

[`template <typename T, size_t N, typename TrappingPolicy> struct bounded_array;`](/documentation/DriverKit/libkern/bounded_array)

[`template <typename T, typename TrappingPolicy> struct bounded_array_ref;`](/documentation/DriverKit/libkern/bounded_array_ref)

[`template <typename T, typename TrappingPolicy> struct bounded_ptr;`](/documentation/DriverKit/libkern/bounded_ptr)

[`template <typename T, typename Allocator, typename TrappingPolicy> struct safe_allocation;`](/documentation/DriverKit/libkern/safe_allocation)

### Variables

[`constexpr const adopt_memory_t adopt_memory;`](/documentation/DriverKit/libkern/adopt_memory)

[`constexpr const allocate_memory_t allocate_memory;`](/documentation/DriverKit/libkern/allocate_memory)

[`constexpr const allocate_memory_zero_t allocate_memory_zero;`](/documentation/DriverKit/libkern/allocate_memory_zero)

### Functions

[`template <typename T, typename Policy> bool operator!=(const bounded_ptr<T, Policy> & p, detail::nullptr_t );`](/documentation/DriverKit/libkern/operator!=-1mtzc)

[`template <typename T, typename Policy> bool operator!=(detail::nullptr_t , const bounded_ptr<T, Policy> & p);`](/documentation/DriverKit/libkern/operator!=-40y7m)

[`template <typename T, typename P, typename U, typename = detail::detail::WhenComparable<T * *, U * *>> bool operator!=(U * *a, const bounded_ptr<T, P> & b);`](/documentation/DriverKit/libkern/operator!=-4tle6)

[`template <typename T, typename P1, typename U, typename P2, typename = detail::detail::WhenComparable<T * *, U * *>> bool operator!=(const bounded_ptr<T, P1> & a, const bounded_ptr<U, P2> & b);`](/documentation/DriverKit/libkern/operator!=-59rjh)

[`template <typename T, typename A, typename P> bool operator!=(sa_detail::nullptr_t , const safe_allocation<T, A, P> & x);`](/documentation/DriverKit/libkern/operator!=-5trzj)

[`template <typename T, typename P> bool operator!=(bar_detail::nullptr_t , const bounded_array_ref<T, P> & x);`](/documentation/DriverKit/libkern/operator!=-6fqjk)

[`template <typename T, typename P> bool operator!=(const bounded_array_ref<T, P> & x, bar_detail::nullptr_t );`](/documentation/DriverKit/libkern/operator!=-ayak)

[`template <typename T, typename A, typename P> bool operator!=(const safe_allocation<T, A, P> & x, sa_detail::nullptr_t );`](/documentation/DriverKit/libkern/operator!=-enw1)

[`template <typename T, typename P, typename U, typename = detail::detail::WhenComparable<T * *, U * *>> bool operator!=(const bounded_ptr<T, P> & a, U * *b);`](/documentation/DriverKit/libkern/operator!=-isyz)

[`bounded_ptr<T, TrappingPolicy> operator+(bounded_ptr<T, TrappingPolicy> p, ptrdiff_t n);`](/documentation/DriverKit/libkern/operator+-6jedg)

[`bounded_ptr<T, TrappingPolicy> operator+(ptrdiff_t n, bounded_ptr<T, TrappingPolicy> p);`](/documentation/DriverKit/libkern/operator+-xw3o)

[`ptrdiff_t operator-(const bounded_ptr<T, TrappingPolicy> & a, const type-parameter-0-0 *b);`](/documentation/DriverKit/libkern/operator--16kds)

[`bounded_ptr<T, TrappingPolicy> operator-(bounded_ptr<T, TrappingPolicy> p, ptrdiff_t n);`](/documentation/DriverKit/libkern/operator--21659)

[`ptrdiff_t operator-(const type-parameter-0-0 *a, const bounded_ptr<T, TrappingPolicy> & b);`](/documentation/DriverKit/libkern/operator--4anod)

[`ptrdiff_t operator-(const bounded_ptr<T, TrappingPolicy> & a, const bounded_ptr<T, TrappingPolicy> & b);`](/documentation/DriverKit/libkern/operator--56d6m)

[`template <typename T, typename P, typename U, typename = detail::detail::WhenComparable<T * *, U * *>> bool operator==(U * *a, const bounded_ptr<T, P> & b);`](/documentation/DriverKit/libkern/operator==-15jrb)

[`template <typename T, typename P> bool operator==(const bounded_array_ref<T, P> & x, bar_detail::nullptr_t );`](/documentation/DriverKit/libkern/operator==-3uipa)

[`template <typename T, typename A, typename P> bool operator==(const safe_allocation<T, A, P> & x, sa_detail::nullptr_t );`](/documentation/DriverKit/libkern/operator==-510e0)

[`template <typename T, typename P> bool operator==(bar_detail::nullptr_t , const bounded_array_ref<T, P> & x);`](/documentation/DriverKit/libkern/operator==-58o3l)

[`template <typename T, typename P, typename U, typename = detail::detail::WhenComparable<T * *, U * *>> bool operator==(const bounded_ptr<T, P> & a, U * *b);`](/documentation/DriverKit/libkern/operator==-6j7ha)

[`template <typename T, typename Policy> bool operator==(detail::nullptr_t , const bounded_ptr<T, Policy> & p);`](/documentation/DriverKit/libkern/operator==-6xlju)

[`template <typename T, typename A, typename P> bool operator==(sa_detail::nullptr_t , const safe_allocation<T, A, P> & x);`](/documentation/DriverKit/libkern/operator==-6y20q)

[`template <typename T, typename Policy> bool operator==(const bounded_ptr<T, Policy> & p, detail::nullptr_t );`](/documentation/DriverKit/libkern/operator==-8elxo)

[`template <typename T, typename P1, typename U, typename P2, typename = detail::detail::WhenComparable<T * *, U * *>> bool operator==(const bounded_ptr<T, P1> & a, const bounded_ptr<U, P2> & b);`](/documentation/DriverKit/libkern/operator==-96xsq)

[`template <typename T, typename U, typename P, typename = detail::detail::WhenOrderable<T * *, U * *>> bool operator>(T * *a, const bounded_ptr<U, P> & b);`](/documentation/DriverKit/libkern/operator_-1teoa)

[`template <typename T, typename U, typename P, typename = detail::detail::WhenOrderable<T * *, U * *>> bool operator<(T * *a, const bounded_ptr<U, P> & b);`](/documentation/DriverKit/libkern/operator_-360qk)

[`template <typename T, typename U, typename P1, typename P2, typename = detail::detail::WhenOrderable<T * *, U * *>> bool operator<(const bounded_ptr<T, P1> & a, const bounded_ptr<U, P2> & b);`](/documentation/DriverKit/libkern/operator_-5tucm)

[`template <typename T, typename U, typename P, typename = detail::detail::WhenOrderable<T * *, U * *>> bool operator>(const bounded_ptr<T, P> & a, U * *b);`](/documentation/DriverKit/libkern/operator_-6mjvi)

[`template <typename T, typename U, typename P1, typename P2, typename = detail::detail::WhenOrderable<T * *, U * *>> bool operator>(const bounded_ptr<T, P1> & a, const bounded_ptr<U, P2> & b);`](/documentation/DriverKit/libkern/operator_-89g32)

[`template <typename T, typename U, typename P, typename = detail::detail::WhenOrderable<T * *, U * *>> bool operator<(const bounded_ptr<T, P> & a, U * *b);`](/documentation/DriverKit/libkern/operator_-8o5ii)

[`template <typename T, typename U, typename P, typename = detail::detail::WhenOrderable<T * *, U * *>> bool operator>=(const bounded_ptr<T, P> & a, U * *b);`](/documentation/DriverKit/libkern/operator_=-18t07)

[`template <typename T, typename U, typename P, typename = detail::detail::WhenOrderable<T * *, U * *>> bool operator<=(T * *a, const bounded_ptr<U, P> & b);`](/documentation/DriverKit/libkern/operator_=-1fv9b)

[`template <typename T, typename U, typename P1, typename P2, typename = detail::detail::WhenOrderable<T * *, U * *>> bool operator<=(const bounded_ptr<T, P1> & a, const bounded_ptr<U, P2> & b);`](/documentation/DriverKit/libkern/operator_=-1hoqx)

[`template <typename T, typename U, typename P1, typename P2, typename = detail::detail::WhenOrderable<T * *, U * *>> bool operator>=(const bounded_ptr<T, P1> & a, const bounded_ptr<U, P2> & b);`](/documentation/DriverKit/libkern/operator_=-48u68)

[`template <typename T, typename U, typename P, typename = detail::detail::WhenOrderable<T * *, U * *>> bool operator>=(T * *a, const bounded_ptr<U, P> & b);`](/documentation/DriverKit/libkern/operator_=-6ysww)

[`template <typename T, typename U, typename P, typename = detail::detail::WhenOrderable<T * *, U * *>> bool operator<=(const bounded_ptr<T, P> & a, U * *b);`](/documentation/DriverKit/libkern/operator_=-8131f)

[`template <typename T_, typename U, typename Policy> bounded_ptr<T_, Policy> reinterpret_pointer_cast(const bounded_ptr<U, Policy> & ) noexcept;`](/documentation/DriverKit/libkern/reinterpret_pointer_cast-1viq2)

[`template <typename T, typename U> T * *reinterpret_pointer_cast(U * *p) noexcept;`](/documentation/DriverKit/libkern/reinterpret_pointer_cast-61y44)

[`template <typename T, typename U, typename Policy> bounded_ptr<T, Policy> reinterpret_pointer_cast(const bounded_ptr<U, Policy> & p) noexcept;`](/documentation/DriverKit/libkern/reinterpret_pointer_cast-7u0yk)

[`void swap(safe_allocation<T, Allocator, TrappingPolicy> & a, safe_allocation<T, Allocator, TrappingPolicy> & b) noexcept;`](/documentation/DriverKit/libkern/swap)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)