Automatic Differentiation
 
Loading...
Searching...
No Matches
arena_allocator.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_REV_CORE_ARENA_ALLOCATOR_HPP
2#define STAN_MATH_REV_CORE_ARENA_ALLOCATOR_HPP
3
5
6namespace stan {
7namespace math {
8
22template <typename T>
24 using value_type = T;
25
26 arena_allocator() = default;
27
28 arena_allocator(const arena_allocator& rhs) = default;
29
30 template <class U>
32
39 T* allocate(std::size_t n) {
41 }
42
46 void deallocate(T* /*p*/, std::size_t /*n*/) noexcept {}
47
52 constexpr bool operator==(const arena_allocator&) const noexcept {
53 return true;
54 }
59 constexpr bool operator!=(const arena_allocator&) const noexcept {
60 return false;
61 }
62};
63
64} // namespace math
65} // namespace stan
66
67#endif
T * alloc_array(size_t n)
Allocate an array on the arena of the specified size to hold values of the specified template paramet...
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
static thread_local AutodiffStackStorage * instance_
T * allocate(std::size_t n)
Allocates space for n items of type T.
void deallocate(T *, std::size_t) noexcept
No-op.
constexpr bool operator!=(const arena_allocator &) const noexcept
Inequality comparison operator.
constexpr bool operator==(const arena_allocator &) const noexcept
Equality comparison operator.
arena_allocator(const arena_allocator &rhs)=default
arena_allocator(const arena_allocator< U > &rhs)
std library compatible allocator that uses AD stack.