Lines Matching refs:T
53 template <typename T>
54 constexpr bool is_trivially_destructible_v = __is_trivially_destructible(T);
55 template <typename T>
56 constexpr bool is_empty_v = __is_empty(T);
57 template <typename T>
58 constexpr bool is_nothrow_default_constructible_v = __is_nothrow_constructible(T);
60 template <bool Cond, typename T = void> struct enable_if;
61 template <typename T> struct enable_if<true, T> { using type = T; };
62 template <bool Cond, typename T = void> using enable_if_t = typename enable_if<Cond, T>::type;
64 template <typename T> struct remove_const { using type = T; };
65 template <typename T> struct remove_const<T const> { using type = T; };
66 template <typename T> using remove_const_t = typename remove_const<T>::type;
68 template <typename T>
70 generic_swap(T& a, T& b)
72 T tmp = a;
77 template <typename T, enable_if_t<!is_trivially_destructible_v<T> >* = nullptr>
79 destroy(T* first, T* last)
82 first->~T();
86 template <typename T, enable_if_t<is_trivially_destructible_v<T> >* = nullptr>
88 destroy(T*, T*)
93 template <typename T>
95 uninitialized_value_construct(T* first, T* last)
98 ::new (static_cast<void*>(first)) T();
157 template <typename T, typename Allocator, typename TrappingPolicy>
195 explicit safe_allocation(T* data, size_t n, adopt_memory_t) : data_(data)
216 if (__improbable(os_mul_overflow(n, sizeof(T), &bytes) || (n > UINT32_MAX))) {
220 data_ = reinterpret_cast<T*>(Allocator::allocate(bytes));
222 using RawT = sa_detail::remove_const_t<T>;
231 static_assert(__is_scalar(T) || __is_aggregate(T),
234 if (__improbable(os_mul_overflow(n, sizeof(T), &bytes) || (n > UINT32_MAX))) {
238 data_ = reinterpret_cast<T*>(Allocator::allocate_zero(bytes));
298 T* old_data = data_;
332 using iterator = bounded_ptr<T, TrappingPolicy>;
333 using const_iterator = bounded_ptr<T const, TrappingPolicy>;
401 T*
406 T const*
423 OS_ALWAYS_INLINE T&
428 OS_ALWAYS_INLINE T const&
444 destroy_dealloc_(T* ptr, size_t size)
449 using RawT = sa_detail::remove_const_t<T>;
450 Allocator::deallocate(const_cast<RawT*>(ptr), size * sizeof(T));
453 T* data_;
459 template <typename T, typename A, typename P>
461 operator==(safe_allocation<T, A, P> const& x, sa_detail::nullptr_t)
466 template <typename T, typename A, typename P>
468 operator!=(safe_allocation<T, A, P> const& x, sa_detail::nullptr_t)
473 template <typename T, typename A, typename P>
475 operator==(sa_detail::nullptr_t, safe_allocation<T, A, P> const& x)
480 template <typename T, typename A, typename P>
482 operator!=(sa_detail::nullptr_t, safe_allocation<T, A, P> const& x)