Container Utils¶
vtr_memory¶
-
namespace
vtr
-
template<class
T
>
structaligned_allocator
¶ - #include <vtr_memory.h>
aligned_allocator is a STL allocator that allocates memory in an aligned fashion
works if supported by the platform
It is worth noting the C++20 std::allocator does aligned allocations, but C++20 has poor support.
-
struct
t_chunk
¶ - #include <vtr_memory.h>
This structure keeps track to chenks of memory
This structure is to keep track of chunks of memory that is being allocated to save overhead when allocating very small memory pieces. For a complete description, please see the comment in chunk_malloc
Functions
-
template<typename
Container
>
voidrelease_memory
(Container &container)¶ This function will force the container to be cleared.
It release it’s held memory. For efficiency, STL containers usually don’t release their actual heap-allocated memory until destruction (even if Container::clear() is called).
-
template<typename
T
>
T *chunk_new
(t_chunk *chunk_info)¶ Like chunk_malloc, but with proper C++ object initialization.
-
template<typename
T
>
voidchunk_delete
(T *obj, t_chunk*)¶ Call the destructor of an obj which must have been allocated in the specified chunk.
-
inline int
memalign
(void **ptr_out, size_t align, size_t size)¶
-
template<class
vtr_pair_util¶
-
namespace
vtr
-
template<typename
PairIter
>
classpair_first_iter
¶ - #include <vtr_pair_util.h>
Iterator which derefernces the ‘first’ element of a std::pair iterator.
-
template<typename
PairIter
>
classpair_second_iter
¶ - #include <vtr_pair_util.h>
Iterator which derefernces the ‘second’ element of a std::pair iterator
-
template<typename
vtr_map_util¶
-
namespace
vtr
Typedefs
-
using
map_key_iter
= pair_first_iter<Iter>¶ An iterator who wraps a std::map iterator to return it’s key.
-
using
map_value_iter
= pair_second_iter<Iter>¶ An iterator who wraps a std::map iterator to return it’s value.
Functions
-
template<typename
T
>
automake_key_range
(T b, T e)¶ Returns a range iterating over a std::map’s keys.
-
template<typename
Container
>
automake_key_range
(const Container &c)¶ Returns a range iterating over a std::map’s keys.
-
using