Sane C++ Libraries
C++ Platform Abstraction Libraries
Loading...
Searching...
No Matches
SC::VirtualArray< T > Struct Template Reference

An array using a large virtual memory reservation to keep stable addresses. More...

#include <VirtualArray.h>

Public Member Functions

 VirtualArray (size_t maxCapacity)
 
void release ()
 Releases all reserved memory.
 
void clear ()
 Clears the stable array by calling the destructor of each element.
 
bool clearAndDecommit ()
 Clears the array calling destructors of each element and releases virtual memory.
 
bool decommit ()
 De-commits unused-memory, while still keeping the original virtual reservation.
 
bool resizeWithoutInitializing (size_t newSize)
 Resizes the stable array without initializing or calling destructors.
 
bool resize (size_t newSize)
 Resizes the stable array, calling constructors or destructors as needed.
 
bool reserve (size_t maxNumElements)
 Reserves memory for the stable array without initializing elements.
 
size_t capacity () const
 
size_t size () const
 
T * data ()
 
const T * data () const
 
 operator Span< T > ()
 
 operator Span< const T > () const
 
Span< T > toSpan ()
 
Span< const T > toSpan () const
 

Detailed Description

template<typename T>
struct SC::VirtualArray< T >

An array using a large virtual memory reservation to keep stable addresses.

Member Function Documentation

◆ clear()

template<typename T >
void SC::VirtualArray< T >::clear ( )
inline

Clears the stable array by calling the destructor of each element.

Note
Does not release reserved memory (use release() for that).

◆ clearAndDecommit()

template<typename T >
bool SC::VirtualArray< T >::clearAndDecommit ( )
inlinenodiscard

Clears the array calling destructors of each element and releases virtual memory.

◆ decommit()

template<typename T >
bool SC::VirtualArray< T >::decommit ( )
inlinenodiscard

De-commits unused-memory, while still keeping the original virtual reservation.

◆ release()

template<typename T >
void SC::VirtualArray< T >::release ( )
inline

Releases all reserved memory.

Warning
Does not call destructors of contained elements (use clear() for that).

◆ reserve()

template<typename T >
bool SC::VirtualArray< T >::reserve ( size_t maxNumElements)
inlinenodiscard

Reserves memory for the stable array without initializing elements.

◆ resize()

template<typename T >
bool SC::VirtualArray< T >::resize ( size_t newSize)
inlinenodiscard

Resizes the stable array, calling constructors or destructors as needed.

◆ resizeWithoutInitializing()

template<typename T >
bool SC::VirtualArray< T >::resizeWithoutInitializing ( size_t newSize)
inlinenodiscard

Resizes the stable array without initializing or calling destructors.


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