31#ifndef ut0object_cache_h
32#define ut0object_cache_h
53 template <
typename... Types>
56 return extend(
size, std::forward<Types>(args)...);
59 template <
typename... Types>
68 template <
typename... Types>
71 for (
size_t i = 0; i <
size; ++i) {
73 std::forward<Types>(args)...);
A class to manage objects of type T.
Definition: ut0object_cache.h:40
void deallocate(T *obj)
Definition: ut0object_cache.h:83
size_t m_step
When the cache is extended, how many new objects needs to be created.
Definition: ut0object_cache.h:93
std::vector< T * > m_objects
Cached objects.
Definition: ut0object_cache.h:90
dberr_t extend(size_t size, Types &&...args)
Definition: ut0object_cache.h:69
dberr_t init(size_t size, size_t step, Types &&...args)
Initialize the cache.
Definition: ut0object_cache.h:54
size_t m_index
Position of next object to be allocated.
Definition: ut0object_cache.h:96
T * allocate(Types &&...args)
Definition: ut0object_cache.h:60
~Object_cache()
Destructor.
Definition: ut0object_cache.h:43
dberr_t
Definition: db0err.h:39
@ DB_OUT_OF_MEMORY
Definition: db0err.h:49
@ DB_SUCCESS
Definition: db0err.h:43
size_t size(const char *const c)
Definition: base64.h:46
This file contains a set of libraries providing overloads for regular dynamic allocation routines whi...
Definition: aligned_alloc.h:48
void delete_(T *ptr) noexcept
Releases storage which has been dynamically allocated through any of the ut::new*() variants.
Definition: ut0new.h:811
#define ut_ad(EXPR)
Debug assertion.
Definition: ut0dbg.h:105
Dynamic memory allocation routines and custom allocators specifically crafted to support memory instr...
#define UT_NEW_THIS_FILE_PSI_KEY
Definition: ut0new.h:566