Clustering
C++20 header-only: DBSCAN, HDBSCAN, k-means.
Loading...
Searching...
No Matches
clustering::LinearAllocator< T > Class Template Reference

#include <clustering/memory/linear_alloc.h>

Public Member Functions

 LinearAllocator (std::size_t count)
 Reserves room for count objects of T from a single backing allocation.
 ~LinearAllocator ()
 LinearAllocator (const LinearAllocator &)=delete
LinearAllocatoroperator= (const LinearAllocator &)=delete
T * allocate ()
 Bump-allocates one T; throws std::bad_alloc when the arena is exhausted.
void deallocate (T *)
 No-op: trivial destructibility lets per-element reclamation be skipped.
void reset ()
 Rewinds the bump pointer, reclaiming every outstanding allocation in one shot.
bool isDeallocSupported ()
 Reports that per-element deallocate is not supported (false for this allocator).

Detailed Description

template<typename T>
class clustering::LinearAllocator< T >

Definition at line 9 of file linear_alloc.h.

Constructor & Destructor Documentation

◆ LinearAllocator() [1/2]

template<typename T>
clustering::LinearAllocator< T >::LinearAllocator ( std::size_t count)
inline

Reserves room for count objects of T from a single backing allocation.

Definition at line 14 of file linear_alloc.h.

◆ ~LinearAllocator()

template<typename T>
clustering::LinearAllocator< T >::~LinearAllocator ( )
inline

Definition at line 17 of file linear_alloc.h.

◆ LinearAllocator() [2/2]

template<typename T>
clustering::LinearAllocator< T >::LinearAllocator ( const LinearAllocator< T > & )
delete

Member Function Documentation

◆ allocate()

template<typename T>
T * clustering::LinearAllocator< T >::allocate ( )
inline

Bump-allocates one T; throws std::bad_alloc when the arena is exhausted.

Definition at line 23 of file linear_alloc.h.

◆ deallocate()

template<typename T>
void clustering::LinearAllocator< T >::deallocate ( T * )
inline

No-op: trivial destructibility lets per-element reclamation be skipped.

Definition at line 36 of file linear_alloc.h.

◆ isDeallocSupported()

template<typename T>
bool clustering::LinearAllocator< T >::isDeallocSupported ( )
inline

Reports that per-element deallocate is not supported (false for this allocator).

Definition at line 44 of file linear_alloc.h.

◆ operator=()

template<typename T>
LinearAllocator & clustering::LinearAllocator< T >::operator= ( const LinearAllocator< T > & )
delete

◆ reset()

template<typename T>
void clustering::LinearAllocator< T >::reset ( )
inline

Rewinds the bump pointer, reclaiming every outstanding allocation in one shot.

Definition at line 41 of file linear_alloc.h.


The documentation for this class was generated from the following file: